• Resolved indyparker

    (@indyparker)


    Hi Ajay,

    I’ve been using your plugin for a very long time in our theme and it’s never not worked. But recently after upgrading our PHP to 8.1 and updating to WP 6.2.2. the Related Posts have completely stopped working.

    Example post:

    https://shorturl.at/biGKZ

    We use code in our single.php to display the ‘Related Reads’. Currently nothing displays below the title for the Related posts.

    Here is the output from Query Monitor

    QueryCallerComponent

    Error Message

    Error CodeSELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_term_relationships AS crp_tr
    ON (wp_posts.ID = crp_tr.object_id)
    INNER JOIN wp_term_taxonomy AS crp_tt
    ON (crp_tr.term_taxonomy_id = crp_tt.term_taxonomy_id)
    WHERE 1=1
    AND ( wp_posts.post_date <= '2023-07-26 23:12:09' )
    AND wp_posts.ID NOT IN (379924)
    AND wp_posts.post_type = 'post'
    AND ((wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'inherit'))
    AND MATCH (wp_posts.post_title) AGAINST ('7 Indian Foods which High Bad Fats')
    ORDER BY score DESC
    LIMIT 0, 3
    +

    1. WP_Query->get_posts()

    Plugin: contextual-related-postsUnknown column ‘score’ in ‘order clause’1054

    The same database error appears on all posts

    SELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_term_relationships AS crp_tr
    ON (wp_posts.ID = crp_tr.object_id)
    INNER JOIN wp_term_taxonomy AS crp_tt
    ON (crp_tr.term_taxonomy_id = crp_tt.term_taxonomy_id)
    WHERE 1=1
    AND ( wp_posts.post_date <= '2023-07-26 23:16:15' )
    AND wp_posts.ID NOT IN (380664)
    AND wp_posts.post_type = 'post'
    AND ((wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'inherit'))
    AND MATCH (wp_posts.post_title) AGAINST ('MS Dhoni Venture into Acting?')
    ORDER BY score DESC
    LIMIT 0, 3
    +

    1. WP_Query->get_posts()

    Plugin: contextual-related-postsUnknown column ‘score’ in ‘order clause’1054

    Please advise on how to fix this.

    Regards Indy Parker

    • This topic was modified 1 year, 4 months ago by indyparker.

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

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

    (@ajay)

    What is the code you are using in single.php?

    Thread Starter indyparker

    (@indyparker)

    Hi Ajay

    Here is the PHP code:

                         
    
    
    
                            <section class="related-reads-section <?=$sidebar_cat;?>_cate_wid">
    
                                <h2 class="section-title capitalize h2-related">
    
                                    <span>Related Reads</span><i></i>
    
                                </h2>
    
                                <div class="flex">
    
                                    <ul>                                
    
                                    <?php 
    
                                        if ( is_active_sidebar( 'single-related-post' ) ) :
    
                                            dynamic_sidebar( 'single-related-post' );
    
                                        endif; 
    
                                    ?>    
    
                                    </ul>                            
    
                                </div>
    
                                <div class="clear"></div>
    
                            </section>                                          

    And here is the widget registered

    function lym_post_relatedPost() {       
    
        register_sidebar( array(            
    
                    'name' => 'Single Post - Below Posts',          
    
                    'id' => 'single-related-post',
    
                    )); 
    
    }   
    
    add_action( 'widgets_init', 'lym_post_relatedPost' );

    Here is the widget setting for CRP

    https://prnt.sc/GWDRTyGasI1n

    Regards,

    Indy

    Plugin Author Ajay

    (@ajay)

    Thanks. So looks like a standard sidebar with a widget.

    Please can you make a note and reset the settings via Settings > Related Posts. And also remove and add this widget.

    Can you also post screenshots of the Listtuning tab of your settings page.

    Thread Starter indyparker

    (@indyparker)

    Hi Ajay,

    Here are the widget settings:

    https://prnt.sc/6yvNY6Oa2476

    Plugin settings:

    GENERAL

    https://prnt.sc/KOvfkqZD4DW0

    https://prnt.sc/pf5JfwOxaUJF

    LISTTUNING

    https://prnt.sc/0yAGn1xwaC0-

    https://prnt.sc/sBQtWT7QLZ3R

    https://prnt.sc/hqlhxR6ByLI-

    OUTPUT

    https://prnt.sc/cV3HjwsBaQMr

    https://prnt.sc/H8CMvTsOy1AE

    https://prnt.sc/l9Aror6ZkKJ4

    THUMBNAIL

    https://prnt.sc/YrVFeodChfCC

    https://prnt.sc/HT0JcZZ2uHA4

    STYLES:

    https://prnt.sc/5JQZGNIAVJYK

    FEED:

    https://prnt.sc/pWfYkChZKITS

    —————-

    I removed the widget and re-added it. But result is same. Cleared all caches as well.

    https://prnt.sc/93QugGZLGjlo

    Regards,

    Indy

    • This reply was modified 1 year, 4 months ago by indyparker.
    Plugin Author Ajay

    (@ajay)

    Thanks for all of this. I cannot figure out what is happening but something is causing an issue with the fields that are being returned. It could be something as simple as another plugin conflict.

    Are you able to turn off other plugins. I don’t know if you have any custom code snippets?

    The other option is to turn of relevance matching and use the date match in the widget.

    Thread Starter indyparker

    (@indyparker)

    HI Ajay,

    It is a live site, so I cannot switch off the plugins. It started to happen after upgrading to PHP 8.1 last week.

    I tried an experiment and went to our staging server. Where the plugin still works – this is also on PHP 8.1:

    https://prnt.sc/TqRo8NiFFAw8

    https://shorturl.at/doxLZ

    On the staging, 3 plugins are off – due to licensing etc.

    https://prnt.sc/xE6LySUn2GQl

    Where the Related Reads works (using your plugin):

    https://shorturl.at/xyzHX

    https://prnt.sc/GdA3RvV4HsNt

    https://prnt.sc/DPYA78sIawxG

    So, I switched these off on the live server too:

    https://prnt.sc/SKrRd109fIqA

    But no difference, it still does not work ??

    ————

    I tried the date option – it only produces one related read. If I then set it back to relevance. Nothing.

    I really do need a fix to this. I can give you access to my site via a secure link or email.

    Regards,

    Indy

    Plugin Author Ajay

    (@ajay)

    Is your staging site an exact duplicate of your live site. i.e. all the plugins, themes, any custom code, mu-plugins, etc all duplicated exactly?

    I’m always reluctant to get access to a live site but am okay to test things on a staging site.

    Are you able to (instead of using the widget) just use

    i.e. replace this code with echo_crp();

    if ( is_active_sidebar( 'single-related-post' ) ) :
      dynamic_sidebar( 'single-related-post' );
    endif; 

    And, one last thing is complete uninstall and reinstall of the plugin.

    On the disabling of the three plugins above, do you see the same issue when the plugins are active (even if you don’t activate the license)? Although I don’t think that is an issue if disabling them didn’t fix your live site.

    Thread Starter indyparker

    (@indyparker)

    Hi Ajay,

    The staging is the same – it was a snapshot. The plugins have all been updated as per the live. Oddly, it works on there. I can give you access to it.

    Re. the code, not sure how I would replace the active_sidebar check? Can you provide the full code for this segment. What I need to change it to etc.

    Regards,

    Indy

    Plugin Author Ajay

    (@ajay)

                            <section class="related-reads-section <?=$sidebar_cat;?>_cate_wid">
    
                                <h2 class="section-title capitalize h2-related">
    
                                    <span>Related Reads</span><i></i>
    
                                </h2>
    
                                <div class="flex">
    
                                    <ul>                                
    
                                    <?php 
    
                                       echo_crp();
    
                                    ?>    
    
                                    </ul>                            
    
                                </div>
    
                                <div class="clear"></div>
    
                            </section>   

    The above code. Please do backup your site before making changes.

    Does it work if you switch it back to PHP8 or 7.4? I test my plugins up to 8.2 so that shouldn’t be the issue. I think there is some other clash that we aren’t accounting for.

    Please can you contact me via https://webberzone.com/contact/ and reference this post.

    Plugin Author Ajay

    (@ajay)

    @indyparker

    I’ve now pushed through a new version of CRP that should fix this issue.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Related Posts stopped working’ is closed to new replies.