[Plugin: Contextual Related Posts] suggested improvement
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.
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
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().
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…
same problem is being reported on this one: http://wordpress.org/extend/plugins/where-did-they-go-from-here/ :-8
- The topic ‘[Plugin: Contextual Related Posts] suggested improvement’ is closed to new replies.