WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contextual Related Posts] suggested improvement (5 posts)

  1. alanft
    Member
    Posted 4 years ago #

    love this plugin - thank you for writing it. i have found it was producing extra queries when i wasn't expecting it to, and they are quite complex too, so it was quite adversely hitting the site's responsiveness and processor load.

    the related posts calculations are getting called a lot more than is strictly necessary.

    your main filter is add_filter('the_content', 'ald_crp_content'); and ald_crp_content() calls ald_crp() -- the function doing all the hard work. But that's getting called even when all the options to insert the related posts text are turned off and when the output will never be added too.

    so eg on a standard blog home page is_home() or archive page, the_content filter is called for every post that appears that doesn't have an excerpt (such as with a "more" link), and the filter only adds the extra text on is_single, is_page or is_feed.

    my suggestion is rather than calc the text "$output = ald_crp();" first and doing various "return $content.$output" you do a "return $content.ald_crp()" each time - ensuring that the db runs only when the output is to be created.

    FWIW, i don't want the output in the post body -- I've made a widget to show on is_single() pages instead. so to improve performance i've entirely disabled the add_filter line.

    thanks again

    a

    http://wordpress.org/extend/plugins/contextual-related-posts/

  2. alanft
    Member
    Posted 3 years ago #

    Just to restate this. At some point I updated back to your code and my home page went very slow. I've taken out the filter again, and the front page has dropped from 340 queries and 15 seconds, to 90 queries and 4 seconds

  3. dancriel
    Member
    Posted 3 years ago #

    Thanks for posting this alanft, your suggestion greatly reduced load time on my sites using the contextual related posts plugin. I did not widgetize the output, just modified the plugin to make fewer calls to ald_crp().

  4. Ovidiu
    Member
    Posted 3 years ago #

    no idea what is happening people have reported problems in the support forums of this plugin and there is no reaction...

    would one of you make his modded version available via a link please?
    I am not that comfortable editing this plugin...

  5. Ovidiu
    Member
    Posted 3 years ago #

    same problem is being reported on this one: http://wordpress.org/extend/plugins/where-did-they-go-from-here/ :-8

Topic Closed

This topic has been closed to new replies.

About this Topic