Paul Annekov
Member
Posted 1 year ago #
Hi.
I have a custom page for image attachments in my theme. When I go to any page with image attachment, edit attachment description (the same as post content) and save the description there is attachment image appears before the attachment description.
I have solved this bug and want you to solve it in your plugin.
When page loads it there is script includes - wp-include/template-loader.php. On line 29 it removes 'prepend_attachment' filter which add attachment image before the description.
But when your plugin send AJAX request to plugin - template-loader.php script doesn't include.
In my case I just added the same remove_filter to my theme setup action.
What do you think about this?
Posting the relevant code would help.
Also, what version of FEE are you using?
Paul Annekov
Member
Posted 1 year ago #
Version: 2.1.2.
wp-include/template-loader.php, line 29:
remove_filter('the_content', 'prepend_attachment');
core.php in your plugin, line 221:
$result = @apply_filters( $filter, $result ); // TODO: remove, since additional arguments aren't passed
on this line the_content filter applies and prepend_attachment filter applies too by the_content filter.
elseif ( is_attachment() && $template = get_attachment_template() ) :
remove_filter('the_content', 'prepend_attachment');
That's such a hack.
Thanks for bringing this to my attention, but I will not add this to my plugin.
Users will just have to fix it in their theme's functions.php until WP Core decides to do it properly.