WordPress.org

Ready to get started?Download WordPress

Forums

post_content interception, doesn't work anymore (10 posts)

  1. Sergio De Falco
    Member
    Posted 1 year ago #

    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.

  2. Sergio De Falco
    Member
    Posted 1 year ago #

    Yes :) it is

  3. 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/

  4. Sergio De Falco
    Member
    Posted 1 year ago #

    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 :P

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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.

  6. Sergio De Falco
    Member
    Posted 1 year ago #

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

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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.

  8. Sergio De Falco
    Member
    Posted 1 year ago #

    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.

  9. Sergio De Falco
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.