Support » Plugin: Related Posts by Categories and Tags » The plugin has worked fine so far, but now It’s not displaying

  • This is a cpt that use a template made with elementor.
    On the last section, after Check Our London Expert Advice it should appear cpt posts under the title.

    It has been working perfectly for months and now it disappeared.

    The section Popular Hotel Rooms In London works with the plugin too and as you can see it’s displaying fine.

    Both section are related with other cpts based on custom taxonomy, region (london, brussels, etc) and category (meeting, conference, etc)

    Another weird detail is that we have a similar page working with the same sections but in different positions ad it’s giving probems too. Some pages have both sections working, but not perfectly (eg. not showing the right number of post I set) or just one of he sections work.

    Thanks in advance

    • This topic was modified 11 months, 1 week ago by yiselsp.

    The page I need help with: [log in to see the link]

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


    Sorry for the delay in the response. Can you let me know what has changed since then – e.g. was it just sudden?

    Also, what do your settings look like for this custom post type?

    How are these installations of CRP created on that page?

    One option would be to install Query Monitor and see what are the queries generated by the plugin

    Thread Starter yiselsp


    I don’t really know what’s new.

    You can see here the settings.

    I added the plugin through Elementor. And they only thing extra is apply some CSS.

    For query monitor,

    SELECT DISTINCT wpem_posts.ID, wpem_posts.post_date
    FROM wpem_posts
    INNER JOIN wpem_term_relationships AS crpt_tr
    ON (wpem_posts.ID = crpt_tr.object_id)
    INNER JOIN wpem_term_taxonomy AS crpt_tt
    ON (crpt_tr.term_taxonomy_id = crpt_tt.term_taxonomy_id)
    INNER JOIN wpem_terms AS crpt_t
    ON (crpt_tt.term_id = crpt_t.term_id)
    WHERE 1=1
    AND MATCH (post_title) AGAINST (‘Book Your Event Venues in Amsterdam’)
    AND wpem_posts.post_date < ‘2021-01-07 10:46:25’
    AND wpem_posts.post_date >= ‘2018-01-08 10:46:25’
    AND wpem_posts.post_status IN (‘publish’,’inherit’)
    AND wpem_posts.ID != 53647
    AND wpem_posts.post_type IN (‘job_listing’)
    AND CONCAT(crpt_tt.taxonomy, ‘/’, crpt_tt.term_id) IN (‘job_listing_region/2705′,’job_listing_category/40638’)
    GROUP BY wpem_posts.ID
    HAVING ( COUNT(DISTINCT crpt_tt.taxonomy) = 2
    AND COUNT(DISTINCT crpt_tt.term_id) >= 2 )
    ORDER BY MATCH (post_title) AGAINST (‘Book Your Event Venues in Amsterdam’) DESC
    LIMIT 0, 4

    Thanks for the answer.

    Plugin Author Ajay


    Thanks for this – Looking into that query above, I suspect it might be the case that it might not actually be able to find related posts.

    Two things to try:
    1. Turn on search for post title and content – this will only work if your custom post type actually uses the post_content field for the custom post type

    2. Turn off contextual matching – this will take out the MATCH clauses and should hopefully pull out the related posts based on the job listing category and region above.

    P.S. The styling looks amazing on your site.

    Plugin Author Ajay


    I just wanted to add that I’m releasing Contextual Related Posts v3.0.0 which will incorporate these features of the add-on plugin within the main plugin.

    Thread Starter yiselsp


    Thanks for the quick answer!

    Turning the search for post title and content, made it better.
    I tried switching off the contextual, but event though it solves the problem of showing the right amount, the match with the taxonomies is completely off.
    Do you know if I can manage to fix it otherwise?

    And great, can’t wait to see the new version!

    • This reply was modified 11 months ago by yiselsp.
    Plugin Author Ajay


    I’ll release the new version tomorrow morning my time. Everything is draft and ready to go.

    There isn’t much that can be done with the matches beyond this as the use of the taxonomy and category alongside the text is doing the restricting on the posts. Usually I’d have expected the taxonomy and category should have been relevant enough but of course that depends on how you’ve filed that

    Thread Starter yiselsp


    I’ve been talking with our developers and we have been checking any possible answer for this issue. We came to the conclusion that it has to be the plugin.
    The queries are not working as they should. They should be AND not OR.

    I find it really weird, this change all of the sudden. Because a few weeks ago, it worked perfectly and we’ve check if it was something related to the cpts and taxonomies of the website they’re fine.

    This is one of the pages using the the plugin:

    Thanks in advance

    Plugin Author Ajay


    Have you upgraded to v3 since the release. The new version uses WP_Query – you can see the release post / point your devs to that.

    Could you please clarify by what do you mean by AND and not OR in the queries? As an explanation, if it helps:

    AND CONCAT(crpt_tt.taxonomy, ‘/’, crpt_tt.term_id) IN (‘job_listing_region/2705′,’job_listing_category/40638’)

    This part of the query will pick any post IDs where taxonomy-term_id combinations that fall into either region/2705 OR category/40638. The OR part is correct.

    But, then the HAVING part of the query limits this to those entries that have both region AND category and ignores the rest.

    HAVING ( COUNT(DISTINCT crpt_tt.taxonomy) = 2
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘The plugin has worked fine so far, but now It’s not displaying’ is closed to new replies.