Support » Plugin: Contextual Related Posts » Manual related posts show random results on pages

  • Resolved angeloff88

    (@angeloff88)


    Hello.
    After some time the manual related posts that I have entered on all the pages where I want to show related posts, display random results instead of the selected related pages. For example on the link above, I have added 3 id’s and when I go to the edit screen of the page I see that the selected pages are stored and displayed correctly. However on the frontend the results are not the id’s that I have chosen but rather random ones.
    Any way to restore the functionality as it used to be?
    Thanks!

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

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

    (@ajay)

    Can you check what is in your list tuning/output tabs that order by relevance is selected?

    Thread Starter angeloff88

    (@angeloff88)

    Excuse me – look for what and where exactly?

    Thread Starter angeloff88

    (@angeloff88)

    ОК I understood. On the Tuning tab (from Settings) the order by Relevance is chosen.

    Plugin Author Ajay

    (@ajay)

    Might need some additional debugging: please see this: https://webberzone.com/support/knowledgebase/debugging-with-query-monitor/

    Please disable the CRP cache in the Settings page before getting the query.

    Thread Starter angeloff88

    (@angeloff88)

    From what I see there are two queries that might override each other. First the plugin searches for relevant post types that match against the current page. Then it searches for the 3 id’s that I have specifically provided. And then it seems to return the posts that are relevant, not the provided id’s.

    First one:

    SELECT wp_posts.*, MATCH (wp_posts.post_title,wp_posts.post_content) AGAINST ('Инсталиране на WordPress на XAMPP сървър Научи как протича инсталацията на WordPress на локален XAMPP сървър. Към днешна дата стъпките в този видео урок са все още изключително актуални. Въпреки това можеш да преминеш директно към следния видео урок. Като цяло в този урок акцентът е над: 1. Създаване на директория, в която да се поставят изтеглените файлове на WordPress. 2. Конфигуриране на изтеглените файлове с главен фокус над wp-config.php. ВАЖНО - към днешна дата запази wp-config-sample.php и от него си създай другия файл. 3. Създаване на база данни в XAMPP. 4. Завършване на инсталацията и достъп до локалния сайт, изграден на WordPress.Important! ВАЖНО! Демонстрираният тестови…') as score
    FROM wp_posts
    WHERE 1=1
    AND ( wp_posts.post_date <= '2021-02-23 13:00:28' )
    AND wp_posts.ID NOT IN (1861)
    AND wp_posts.post_type = 'post'
    AND ((wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'inherit'))
    AND MATCH (wp_posts.post_title,wp_posts.post_content) AGAINST ('Инсталиране на WordPress на XAMPP сървър Научи как протича инсталацията на WordPress на локален XAMPP сървър. Към днешна дата стъпките в този видео урок са все още изключително актуални. Въпреки това можеш да преминеш директно към следния видео урок. Като цяло в този урок акцентът е над: 1. Създаване на директория, в която да се поставят изтеглените файлове на WordPress. 2. Конфигуриране на изтеглените файлове с главен фокус над wp-config.php. ВАЖНО - към днешна дата запази wp-config-sample.php и от него си създай другия файл. 3. Създаване на база данни в XAMPP. 4. Завършване на инсталацията и достъп до локалния сайт, изграден на WordPress.Important! ВАЖНО! Демонстрираният тестови…')
    ORDER BY score DESC
    LIMIT 0, 3
    SELECT wp_posts.ID
    FROM wp_posts
    WHERE 1=1
    AND wp_posts.ID IN (1852,1863,1865)
    AND wp_posts.post_type = 'post'
    AND ((wp_posts.post_status = 'publish'))
    ORDER BY FIELD(wp_posts.ID,1852,1863,1865)
    LIMIT 0, 5
    • This reply was modified 1 month, 4 weeks ago by angeloff88.
    Thread Starter angeloff88

    (@angeloff88)

    As an update – the second query seems to be wrong. It finds no id’s as the provided id’s are for pages not posts. If I change the query to AND wp_posts.post_type = ‘page’ then it returns the results.

    Plugin Author Ajay

    (@ajay)

    Thanks for the spot – the post types are selected via the Settings page. Can you check that when you visit the settings page > List Tuning > Post types to include.

    Is posts and pages selected there?

    Similar setting if you’re using the widget.

    Thread Starter angeloff88

    (@angeloff88)

    I have checked to checkbox and the manually chosen pages now appear where I want them to appear. However on the posts now I see page suggestions as well as posts. Is there a way to limit the related posts on posts to show only other related posts, not other post types?

    • This reply was modified 1 month, 3 weeks ago by angeloff88.
    Plugin Author Ajay

    (@ajay)

    I think there might be a solution that I’ll also implement in the next version. Idea would be to ignore post types if these are manually entered IDs.

    Would you be able to edit this file and line and delete it. This should open up the post types in get_posts

    https://github.com/WebberZone/contextual-related-posts/blob/v3.0.5/includes/class-crp-query.php#L672

    Thread Starter angeloff88

    (@angeloff88)

    Without line 672 if the checkbox for pages under List tuning is not checked, the plugin behaves like before. If the line is removed and the checkbox is placed then the pages appear but it does not show the manually chosen id’s. Just suggests random posts and pages that might be related.

    I will restore the line and will continue with the checkbox for pages under List tuning. I believe this resolves my issue. Thank you for your support!

    Plugin Author Ajay

    (@ajay)

    Thanks. I think we need to do more debugging as I’m planning on knocking out that line. However, it might make sense to wait for the next version which is later this week and we take a look if the issue comes back.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.