• Resolved Sunfire

    (@chillsunfire)


    I updated the plugin last night on a client’s website. I ran the meta migration, which was surprisingly quick considering how many posts this site has.

    When looking at a post on the front end with CRP enabled, we are seeing the following error (obscured server path for privacy):

    Uncaught Error: Unsupported operand types: string * int
    in /[...]/wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php on line 484

    Call stack:

    1. WebberZone\Contextual_Related_Posts\CRP_Core_Query::prepare_query_args(array)
      wp-content/plugins/contextual-related-posts/includes/class-crp-core-query.php:152
    2. WebberZone\Contextual_Related_Posts\CRP_Core_Query::__construct(array)
      wp-content/plugins/contextual-related-posts/includes/class-crp-query.php:36
    3. …snipped…

    Not sure what this is about, so for now we have disabled the plugin.

    If you need more details about the site for troubleshooting, please let me know.

    • This topic was modified 8 months ago by Sunfire.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ajay

    (@ajay)

    @chillsunfire please can you tell me what version of PHP you’re running?

    Also, what is the setting for the Number of posts in the settings page?

    I’ve applied a fix of specifically casting the limit to integer in the following file. Are you in a position to test this out – ideally on a staging site?

    https://github.com/WebberZone/contextual-related-posts/releases/tag/4.2.1-beta1

    Thread Starter Sunfire

    (@chillsunfire)

    We are on PHP version 8.3.3 and left the number of posts setting empty (this used to default to 6, I believe, and that amount was fine).

    I’ll see about testing that fix and report back.

    Plugin Author Ajay

    (@ajay)

    Is there a reason you have that as empty? In the beta, if it is empty, it will cast it to 0 so you’ll have the posts_per_page as 0 when passing to WP_Query i.e. 0 posts.

    Thread Starter Sunfire

    (@chillsunfire)

    I believe previously, if left empty, it would default to 6, but I could be mistaken. I will be sure to set a value in there just to be sure.

    Plugin Author Ajay

    (@ajay)

    The settings page is the global catch-call so you’ll need to put a setting there. I’ll had some safeguards in place in the next version to prevent a 0 being set.

    Thread Starter Sunfire

    (@chillsunfire)

    I added a value in that setting (still on version 4.2.0) and that seemed to do the trick.

    I forgot that I am not able to upload plugins manually for security reasons, so I couldn’t test the beta.

    Thanks for the quick reply. Looks like we’re back in business on my client’s site.

    Thread Starter Sunfire

    (@chillsunfire)

    Ah, now I remember…. We sometimes manually select related posts, but only one or two. Having a value in “number of posts” meant more posts would be included beyond the manually selected ones, which was not ideal.

    Is there a way to ensure that, if we manually select related posts but the number of manually selected is fewer than in the settings, additional “related” posts are not added to the list?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Error after update to 4.2.0’ is closed to new replies.