• The filter in popular posts widget doesn’t seems to be working. I’ve selected some categories in “Only from categories” field, but the widget is already showing posts from other categories not into the selected one.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Ajay

    (@ajay)

    That field is supposed to be an autocomplete but doesn’t seem to work in the new widgets interface.

    I’ve filed this issue in Github and I’ll get this fixed in the next version where you can only pass a set of IDs directly instead of typing the words. Not ideal but cleaner.

    https://github.com/WebberZone/top-10/issues/132

    Thread Starter fidoboy

    (@fidoboy)

    I am not using the new widget interface but the old one (there is a plugin to enable it). Autocomplete seems to work fine, I can locate the categories starting to type the first characters and then I select the right one. The issue is that after saving, the generated query doesn’t use the selected categories (I’ve looking for them with Query Monitor). There is also a field to write some IDs (I’m not sure if they are for categories or posts IDs, because it doesn’t says anything)

    I have a similar problem. I have updated today to the latest version 3.2.1.

    in the shortcode below, which I succesfully use for over 5 years, INCLUDE_CAT_IDS are no longer applied by the plugin.

    [tptn_list heading=’0′ how_old=14 include_cat_ids=”10″ show_date = ‘1’ limit=’5′ disp_list_count = ‘0’ show_author=’1′]

    Plugin Author Ajay

    (@ajay)

    @jelstein

    Are you able to debug this with Query Monitor and tell me what query is generated?

    I’ve not changed anything with include_cat_ids in this version. But, I’ll do some testing at my end as well.

    Plugin Author Ajay

    (@ajay)

    Actually I think there’s a bug in the tax query.

    I’ve pushed through an updated version of the beta. Could you give this a try?

    https://github.com/WebberZone/top-10/releases/tag/v3.2.2-beta1

    32 SELECT option_value
    FROM wp_options
    WHERE option_name = ‘tptn_db_version’
    LIMIT 1
    get_option()
    Plugin installeren: top-10 1 0,0002
    48 SELECT option_value
    FROM wp_options
    WHERE option_name = ‘medium_crop’
    LIMIT 1
    get_option()
    Plugin installeren: top-10 0 0,0003
    49 SELECT option_value
    FROM wp_options
    WHERE option_name = ‘medium_large_crop’
    LIMIT 1
    get_option()
    Plugin installeren: top-10 0 0,0002
    50 SELECT option_value
    FROM wp_options
    WHERE option_name = ‘large_crop’
    LIMIT 1
    get_option()
    Plugin installeren: top-10 0 0,0002
    250 SELECT post_id, meta_value
    FROM wp_postmeta
    WHERE meta_key = ‘tptn_post_meta’
    tptn_exclude_post_ids()
    Plugin installeren: top-10 0 0,0003
    251 SELECT wp_posts.*,wp_top_ten.postnumber, wp_top_ten.cntaccess as visits, wp_top_ten.blog_id
    FROM wp_posts
    INNER JOIN wp_top_ten
    ON wp_top_ten.postnumber=wp_posts.ID
    WHERE 1=1
    AND ( ( wp_posts.post_date >= ‘2022-09-04 22:00:00’
    AND wp_posts.post_date <= ‘2022-09-19 22:17:10’ ) )
    AND wp_posts.post_type = ‘post’
    AND ((wp_posts.post_status = ‘publish’
    OR wp_posts.post_status = ‘inherit’))
    AND wp_top_ten.blog_id IN (‘1’)
    ORDER BY visits DESC
    LIMIT 0, 15
    WP_Query->get_posts()
    Plugin installeren: top-10 15 0,0151
    252 SELECT DISTINCT t.term_id, tr.object_id
    FROM wp_terms AS t
    INNER JOIN wp_term_taxonomy AS tt
    ON t.term_id = tt.term_id
    INNER JOIN wp_term_relationships AS tr
    ON tr.term_taxonomy_id = tt.term_taxonomy_id
    WHERE tt.taxonomy IN (‘category’, ‘post_tag’, ‘post_format’)
    AND tr.object_id IN (121520, 121093, 121450, 121136, 121252, 121425, 121417, 121221, 121076, 120996, 121388, 121064, 121194, 121293, 121463)
    ORDER BY t.name ASC
    WP_Term_Query->get_terms()
    Plugin installeren: top-10 58 0,0010
    253 SELECT t.*, tt.*
    FROM wp_terms AS t
    INNER JOIN wp_term_taxonomy AS tt
    ON t.term_id = tt.term_id
    WHERE t.term_id IN (4067,9174,151,469,330,830,4917,1887,829,9169,5493,639,7905,4119,3581,1119,6229,4354,9173,9171,4333,21,9167,325)
    _prime_term_caches()
    Plugin installeren: top-10 24 0,0006
    254 SELECT post_id, meta_key, meta_value
    FROM wp_postmeta
    WHERE post_id IN (121520,121093,121450,121136,121252,121425,121417,121221,121076,120996,121388,121064,121194,121293,121463)
    ORDER BY meta_id ASC
    update_meta_cache()
    Plugin installeren: top-10 377 0,0015
    255 SELECT *
    FROM wp_users
    WHERE ID = ‘182’
    LIMIT 1
    WP_User::get_data_by()
    Plugin installeren: top-10 1 0,0003
    256 SELECT user_id, meta_key, meta_value
    FROM wp_usermeta
    WHERE user_id IN (182)
    ORDER BY umeta_id ASC
    update_meta_cache()
    Plugin installeren: top-10 38 0,0004
    257 SELECT *
    FROM wp_users
    WHERE ID = ’20’
    LIMIT 1
    WP_User::get_data_by()
    Plugin installeren: top-10 1 0,0003
    258 SELECT user_id, meta_key, meta_value
    FROM wp_usermeta
    WHERE user_id IN (20)
    ORDER BY umeta_id ASC
    update_meta_cache()
    Plugin installeren: top-10 80 0,0006
    259 SELECT *
    FROM wp_users
    WHERE ID = ’75’
    LIMIT 1
    WP_User::get_data_by()
    Plugin installeren: top-10 1 0,0002
    260 SELECT user_id, meta_key, meta_value
    FROM wp_usermeta
    WHERE user_id IN (75)
    ORDER BY umeta_id ASC
    update_meta_cache()
    Plugin installeren: top-10 38 0,0003
    294 SELECT post_id, meta_value
    FROM wp_postmeta
    WHERE meta_key = ‘tptn_post_meta’
    tptn_exclude_post_ids()
    Plugin installeren: top-10 0 0,0003
    295 SELECT wp_posts.*,wp_top_ten_daily.postnumber, SUM(wp_top_ten_daily.cntaccess) as visits, wp_top_ten_daily.blog_id
    FROM wp_posts
    INNER JOIN wp_top_ten_daily
    ON wp_top_ten_daily.postnumber=wp_posts.ID
    WHERE 1=1
    AND ( wp_posts.post_date <= ‘2022-09-19 22:17:10’ )
    AND wp_posts.post_type = ‘post’
    AND ((wp_posts.post_status = ‘publish’
    OR wp_posts.post_status = ‘inherit’))
    AND wp_top_ten_daily.blog_id IN (‘1’)
    AND wp_top_ten_daily.dp_date >= ‘2022-09-16 22:0:0’
    GROUP BY wp_top_ten_daily.postnumber
    ORDER BY visits DESC
    LIMIT 0, 15
    WP_Query->get_posts()
    Plugin installeren: top-10 15 0,3005
    296 SELECT DISTINCT t.term_id, tr.object_id
    FROM wp_terms AS t
    INNER JOIN wp_term_taxonomy AS tt
    ON t.term_id = tt.term_id
    INNER JOIN wp_term_relationships AS tr
    ON tr.term_taxonomy_id = tt.term_taxonomy_id
    WHERE tt.taxonomy IN (‘category’, ‘post_tag’, ‘post_format’)
    AND tr.object_id IN (121476, 121482, 121527, 121511, 121551, 121540, 121485, 121490, 121496)
    ORDER BY t.name ASC
    WP_Term_Query->get_terms()
    Plugin installeren: top-10 33 0,0008
    297 SELECT t.*, tt.*
    FROM wp_terms AS t
    INNER JOIN wp_term_taxonomy AS tt
    ON t.term_id = tt.term_id
    WHERE t.term_id IN (7564,300,1452,7448,986,269,9176,6439,5389,9172,5437,9175,819)
    _prime_term_caches()
    Plugin installeren: top-10 13 0,0007
    298 SELECT post_id, meta_key, meta_value
    FROM wp_postmeta
    WHERE post_id IN (121476,121482,121527,121511,121551,121540,121485,121490,121496)
    ORDER BY meta_id ASC
    update_meta_cache()
    Plugin installeren: top-10 233 0,0018
    299 SELECT post_id, meta_value
    FROM wp_postmeta
    WHERE meta_key = ‘tptn_post_meta’
    tptn_exclude_post_ids()
    Plugin installeren: top-10 0 0,0003
    300 SELECT wp_posts.*,wp_top_ten_daily.postnumber, SUM(wp_top_ten_daily.cntaccess) as visits, wp_top_ten_daily.blog_id
    FROM wp_posts
    INNER JOIN wp_top_ten_daily
    ON wp_top_ten_daily.postnumber=wp_posts.ID
    WHERE 1=1
    AND ( wp_posts.post_date <= ‘2022-09-19 22:17:11’ )
    AND wp_posts.post_type = ‘post’
    AND ((wp_posts.post_status = ‘publish’
    OR wp_posts.post_status = ‘inherit’))
    AND wp_top_ten_daily.blog_id IN (‘1’)
    AND wp_top_ten_daily.dp_date >= ‘2022-09-16 22:0:0’
    GROUP BY wp_top_ten_daily.postnumber
    ORDER BY visits DESC
    LIMIT 0, 15

    Thread Starter fidoboy

    (@fidoboy)

    This beta works better, but already is not completely fine. For me, it works well when there is only one included category, but it fails when I add more into the widget (it shows posts from ALL categories). Also it seems that if it’s a parent category, its childs are not being included.

    • This reply was modified 2 years, 2 months ago by fidoboy.
    Plugin Author Ajay

    (@ajay)

    On the latter part, that is correct on children not being included. You’ll need to add them all. This is intentional.

    What do you see when you include more than one category. Say if you do 3?

    Thread Starter fidoboy

    (@fidoboy)

    Okay, knowing that it is intentional, I will take it into account and I will add all the child categories one by one. It would be good to add a switch so that it could be done automatically. (If the user activates it, then all sub-categories are included)

    About the issue when adding more than one category into the widget field, when I add more than one, then there is no filter, all of them are being included. For example, when I add only one, it works fine and I get results from this category only, but when I add one more, then I get results from all categories without exclusions.

    • This reply was modified 2 years, 2 months ago by fidoboy.
    Thread Starter fidoboy

    (@fidoboy)

    I suppose that I should separate category names with commas, isn’t it? Either way, when I save the widget the category names appears enclosed with double quotes and separated by commas, so I think that I’m doing it right.

    • This reply was modified 2 years, 2 months ago by fidoboy.
    Thread Starter fidoboy

    (@fidoboy)

    It seems that now it’s working fine. I don’t know what happened. May be it was the plugin cache or something weird. But I believe that now it’s working as expected. If I notice anything not working, I’ll warn about it here. I’m sorry for the confusion.

    Plugin Author Ajay

    (@ajay)

    I think it could be the lack of the comma and probably the cache.

    Given I need wider compatibility, in the next version, I’ll be doing away with the box. However, the plugin should work seamlessly as the category IDs are recorded in a hidden field in the widget settings.

    I had done the same to update my other plugin due to this issue.

    Hi @ajay

    I had a similar issue on one of the sites I manage. Up to v, 3.1.3 it was working fine, but when the plugin was updated to 3.2.1, it was showing only posts in the main “posts” category despite it being unchecked, and did not show anything of the other ones that were checked.

    So I uninstalled v3.1.3 and installed v3.2.2 Beta 2, and the issue was fixed ??
    It’s a site that hosts podcasts from several radio shows, so it had to show the popular posts filed under “Releases” as it was doing just fine on previous versions, but somehow v3.2.1 stopped doing that, and v3.2.2 Beta 2 fixed it.

    Just wanted to let you know. Thank you very much.

    Plugin Author Ajay

    (@ajay)

    @claudiodc Thank you for confirming as well!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Popular posts widget filtering by category’ is closed to new replies.