Support » Plugin: ReOrder Posts within Categories » Very slow category page when plugin is activated

  • Resolved maorb

    (@maorb)


    Hi,

    Thanks for your plugin, which does exactly what I need!
    I’ve recently installed this plugin on a site I run for several years.
    I have on that site some Custom post types and Custom taxonomies that are defined.
    All taxonomy and category archives are loading fast on the frontend.

    I’ve set your plugin to activate only on one custom taxonomy of the posts post type, and those custom taxonomy archive pages also work well, fast, and manually ordered.

    However, the default WordPress Category taxonomy archive, has become v-e-r-y slow on the frontend. Not all categories, but one category which has more than 2000 posts, is being loaded very slow, and so also another category archive page with 850 posts, is being loaded very slow.
    Other categories with about 200 posts are being loaded fast.

    When the Reorder-post-within-categories – all categoies archives are again being loaded very fast.

    I do have several (2-3) get_posts function on the category.php template file, but anyway I didn’t mark the Categories taxonomy to be activate with your plugin, only another taxonomy. So why your plugin is affecting the category.php anyway, if the cateogry is not to be sorted with the plugin?

    How (or if?) can I resolve this please?
    Maybe there’s a filter function that I should add to eliminate the plugin “mess” the default category?

    Thanks ahead,
    Maor

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    However, the default WordPress Category taxonomy archive, has become v-e-r-y slow on the frontend. Not all categories, but one category which has more than 2000 posts, is being loaded very slow, and so also another category archive page with 850 posts, is being loaded very slow.

    have you manually sorted all of them? are these posts category archive query being paged?

    I didn’t mark the Categories taxonomy to be activate with your plugin, only another taxonomy. So why your plugin is affecting the category.php anyway, if the cateogry is not to be sorted with the plugin?

    it shouldn’t.

    How (or if?) can I resolve this please?

    you would need to investigate further into what is happening at the code level to see why your queries are so slow.

    When deactivate the plugin, the speed increases?

    Thread Starter maorb

    (@maorb)

    Thanks for your reply.

    When deactivate the plugin, the speed increases?

    Yes, I now see I had a mistype in my question.. When this plugin is deactivated – everything works great and fast.
    The slowness is only when this plugin is activate.

    have you manually sorted all of them?

    no, I didn’t manually sorted them, and I didn’t check the categoeries checkbox in the plugin’s setup page. This is why it is so weird, because your plugin should not have any effect on the category.php archive page, but it seems it does affect. As I mentoined, when I deactivate your plugin – everything comes back to normal and fast.

    are these posts category archive query being paged?

    yes, they are being paged, about 16 posts per page (first page has some more post queries)

    However, my category.php is complexed because this is a news site and has some special needs for that category archive, so I have there several get_posts() and query_posts() functions that are running.
    Again – when your plugin is deactiveted, it works just fine. Slow issue occur only when your plugin is active.

    Below you may see sample for some of the code I use in the category.php file.
    I suspect that since your plugin uses the posts_join, posts_where, and posts_orderby filters, it may be the reason.

    
    //this only on first page of categoty archive 
    $channel_pull = get_posts('cat='.$catid.'&showposts=1&meta_key=_pull_channel_first&meta_value=on&orderby=DESC');
    //some more code
    //some more code
    $channel_pull_items = get_posts('cat='.$catid.'&showposts=5&meta_key=_pull_channel&meta_value=on&orderby=rand');
    //some more code
    //some more code
    wp_reset_query()
    
    //some more code
    //some more code
    //this for all pages of category archive
    $args= array('cat' => $catid, 'post__not_in' => $in_the_pull_ids, 'posts_per_page' => 16, 'paged' => $paged, 'post_type' => array('post', 'updates'));
    			query_posts($args);
    query_posts($args);
    

    So anyway since I don’t need any intervention of this plugin in the category.php, I thought to add some remove_filter() funcitons to my category.php file, to remove all your plugin filters from there, and see if it fixes my issue with categories.

    Would you please help me, what are all the filters I should remove there in order to cancel the operation of the plugin?
    (And if it will work fine and solve the issue, you will be able to check why the plugin still works in a category.php even when the categories checkbox is unchecked in the plugin’s setup page)

    • This reply was modified 1 year, 8 months ago by maorb.
    • This reply was modified 1 year, 8 months ago by maorb.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    so I have there several get_posts() and query_posts() functions that are running.
    Again – when your plugin is deactiveted, it works just fine. Slow issue occur only when your plugin is active.

    ok, so I reckon this is where the speed issue might be creeping in. I will see if I can do some checks on my server, but I reckon I will need access to your setup to analyse the issue.

    Would you be able to reach out to me on vrata at syllogic dot in

    I suspect that since your plugin uses the posts_join, posts_where, and posts_orderby filters, it may be the reason.

    get_posts have supress_filters=true by default, so the initial queries would not be affected.

    You could try to set supress_filters=true in your query_post query arguments for the category.php, this will speed up the queries.

    Thread Starter maorb

    (@maorb)

    @aurovrata Thanks for your reply.

    I’m not sure that using supress_filters=true will be a good idea, since there might be some other filters that should be running there and not needed to be supressed in category.php.
    Anyway, I did try it for a test and added supress_filters=true to the query_post query parameters, but it made no change at all, so it is still slow on the category archive page.

    Thus I thought to add a remove_filter function in the category.php template, in order to remove from there all the filter functions that being added by your plugin, so it will ensure they won’t be running there.
    (I still wonder why this plugin’s function are running in the cateogry archive template, altough the cateogry is not selected in the plugin’s setup page.)

    I’ve just sent you a mail to vrata at syllogic dot in.
    Check an email from maor at maorb dot info

    Thanks

    Plugin Author Aurovrata Venet

    (@aurovrata)

    v2.9 should now fix this.

    Thread Starter maorb

    (@maorb)

    Yes, v2.9 does fix this.
    Thank you very much @@aurovrata for all your help and efforts and time for debugging this issue and finding the reason to some slow queries.

    all works fine now as should be.
    You deserve all the glory!

    Plugin Author Aurovrata Venet

    (@aurovrata)

    You deserve all the glory!

    how about a couple of beers 😉

    Thread Starter maorb

    (@maorb)

    I wish to be in India and have a beer with you now.
    But I’m not.. So send me what is your paypal account and how much costs a beer in India 🙂

    • This reply was modified 1 year, 7 months ago by maorb.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    I wish to be in India and have a beer with you now.

    I will come to visit Israel one day! My brother-in-law is from Tel Aviv!

    So send me what is your paypal account

    you can use the plugin’s donation link… many thanks!

    Thread Starter maorb

    (@maorb)

    Great to hear thatm, you are very invited to Tel Aviv!

    I used the plugin’s donation link, you’ve received some money for your beer 🙂

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Yes, I got it, many thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Very slow category page when plugin is activated’ is closed to new replies.