Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media attachment browser no longer provides data-id attribute #3

Open
dpfeil-hb opened this issue Jan 17, 2020 · 2 comments
Open

Media attachment browser no longer provides data-id attribute #3

dpfeil-hb opened this issue Jan 17, 2020 · 2 comments

Comments

@dpfeil-hb
Copy link

In the pop-ip I got the message:
{"status":"error","message":"could not get metadata for attachment() try reuploading the file"}

Related to this Issue: https://core.trac.wordpress.org/ticket/48236 the 'data-id' of the attachhment is no longer availibel. The plug-in uses the attribute in ManuelImageCrop.php

var postId = jQuery('.attachment-details').attr('data-id');
jQuery('.button.crop-image-ml.crop-image').remove();
jQuery('.button.edit-attachment').after( ' <a class="thickbox mic-link crop-image-ml crop-image button" rel="crop" title="<?php esc_attr_e('Manual Image Crop','microp'); ?>" href="' + ajaxurl + '?action=mic_editor_window&postId=' + postId + '"><?php _e('Crop Image','microp'); ?></a>' );

So of course, reuploading does not help.

@tpow
Copy link
Owner

tpow commented Feb 12, 2020

Thanks for the bug report and noting the WordPress ticket. As bug reporter described in the WordPress ticket, I am also unsure how to work around this without access to the Id. I hope it gets reverted in WordPress.

Pull requests and suggestions are welcome.

@dpfeil-hb
Copy link
Author

I fixed it locally. (At the moment) you can find the id in the url-params

var urlParams = new URLSearchParams(window.location.search);
var postId = urlParams.get('item');

Did the magic in line 105.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants