Support » Plugins » Hacks » the_editor($content) and wp_editor($content) not displaying read more tags

  • Resolved Spike


    I was writing my own plugin that uses the_editor(). I have found wp_editor() too, however they both function the same in this regard.

    If a user enters a post (from inside my plugin) with a read more tag, it works fine when viewing the post.

    When accessing the post again inside my plugin, the read-more tag is lost. Instead, in html view it is displayed as this: <span id=”more-38″></span>. It is completely lost in visual mode and disappears from the html view if you flip between the two views.

    Here’s the code in the plugin that calls the content and places it into the editor. The content is displayed correctly inside of the editor, but the readmore is no longer functional, and if the post is submitted again without replacing the read more it is lost.

    Would be ideal if the_editor() functioned how it does when creating a post!

    <?php global $more;    // Declare global $more (before the loop). ?>
    <?php $more = 1;       // Set (inside the loop) to display all content, including text below more. ?>
    $content = get_the_content();
    wp_enqueue_script(array('jquery', 'editor', 'thickbox', 'media-upload'));
    <?php the_editor($content);?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael


    Forum Moderator

    afaik, get_the_content() already applies some filters;

    (see /wp-includes/post-template.php line171++ )

    possibly try to use $post->post_content instead (maybe with global $post; before it).

    Resolved! Thank you. Here’s the code I inserted for anyone curious.

    <!-- Inside the loop -->
    global $post;
    wp_enqueue_script(array('jquery', 'editor', 'thickbox', 'media-upload'));
    <?php the_editor($post->post_content);?>

    I was able to remove the global more and setting more to 1 as well since I was calling post_content. Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_editor($content) and wp_editor($content) not displaying read more tags’ is closed to new replies.