WordPress.org

Support

Support » Alpha/Beta » post_content interception, doesn't work anymore

post_content interception, doesn't work anymore

  • Hi,

    I’m developing SGR NextPage Titles, a plugin that intercept post_content and do some replacings in order to make multiple pages.

    Now, even if everything is working good on 3.5.1, on 3.6.0, if I replace my custom code with <!–nextpage–>, I can see the <!–nextpage–> code in html and WordPress doesn’t split the post into multiple pages.

    What’s new about this on the new WP version?
    Can I fix it?

    Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Yes 🙂 it is

    Normal nextpage, without your plugin, works fine.

    I wonder if it’s related to this: http://markjaquith.wordpress.com/2013/04/04/wordpress-36-shortcode-attribute-filter/

    I already readed this, but mine is not really a shortcode, because it replaces [nextpage] shortcode with <!–nextpage-> “before” WordPress manage them as a real shortcodes… in the ‘wp’ action. If I would use them as real shortcodes, the post will recognize them when WordPress core already managed <!–nextpage–> codes, so it would be too late. I hope I explained it good 😛

    The <!–nextpage–> tag is processed prior to all filtering mechanisms, at the point of setup_postdata. Therefore you cannot simply add a nextpage tag using a filter and have it work, because you’re adding it too late in the process.

    Basically, when your Loop calls the_post(), the next post is retrieved from the query and the global post info variables are set. The nextpage tag is processed at this time.

    Short version: You can’t add in a nextpage tag using a filter or anything of the sort. You have to put it in the actual post_content before setup_postdata is called.

    Thanks otto for your answer,
    Anyway SGR NextPage Titles worked pretty good on 3.5.x, is something changed about this on 3.6?

    I have no idea, as I have not examined your code in specific. I was simply stating that you cannot insert a nextpage tag with a filter. You need to add that to the post_content earlier in the process.

    Without a specific code example to look at, I can’t be any more specific than that.

    I do know that if you’re hooking to “wp” then you’re probably doing it wrong. The global $post isn’t setup at that point, it’s set up when the_post() is called.

    Yes, I’m hooking it to wp. At this point I do replacements in global $post->post_content… Could you help me to understand what’s wrong? In that way, if i print the $post->post_content value, it display the right post, so I supposed that global post is already setup at that point.

    Infact, the wrong in 3.6 is that the “<!–nextpage–>” replacements are visible in the html code but not processed as multiple pages.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘post_content interception, doesn't work anymore’ is closed to new replies.
Skip to toolbar