Forums

Front-end Editor
Attachment image appends after description saving (5 posts)

  1. Paul Annekov
    Member
    Posted 9 months 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?

  2. scribu
    Member
    Posted 9 months ago #

    Posting the relevant code would help.

    Also, what version of FEE are you using?

  3. Paul Annekov
    Member
    Posted 9 months 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.

  4. scribu
    Member
    Posted 9 months ago #

    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.

  5. scribu
    Member
    Posted 9 months ago #

Reply

You must log in to post.

About this Plugin

About this Topic