Site logo

[Support request] Function get_the_excerpt was called with an argument that is deprecated

Home Forums Support [Support request] Function get_the_excerpt was called with an argument that is deprecated

Home Forums Support Function get_the_excerpt was called with an argument that is deprecated

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2499542
    Steve

    Function get_the_excerpt was called with an argument that is deprecated
    in do_action called at /home/redacted/public_html/production/wp-content/themes/generatepress/footer.php (22)

    I use an Element to populate the footer, which uses dynamic content to get the excerpt.

    This error is specifically on tag pages. I believe I have reported something similar about this for category pages in the past.

    Thanks!

    #2499545
    Steve

    FWIW, this is a tag that has no posts associated, which could be influencing the error. It would be great to sort this out for tag pages that have zero posts either way. Thanks again!

    #2499551
    Fernando
    Customer Support

    Hi Steve,

    What version of PHP are you using for your website?

    #2499557
    Steve

    8.0

    also: redis object cache, nginx page cache

    #2499948
    David
    Staff
    Customer Support

    Hi there,

    just to confirm, does this error only occur on tag archives that have no posts ?

    #2500786
    Steve

    Yes, that is my understanding.

    #2500794
    Steve

    This also happens on The Event Calendar archive pages, I’ve included a link below. Seems to be an issue with any page that has a no posts situation.

    #2501231
    David
    Staff
    Customer Support

    Try this PHP Snippet:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
    
        if ( 456 === $element_id && ! have_posts() ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Where 456 is the ID of the block element, change that to the ID of the Content Template.
    That should make it so an empty archive returns No Results and that in turn should stop the footer element from throwing an error.

    Let me know.

    #2519078
    Steve

    Thanks, I will try this soon.

    #2519746
    David
    Staff
    Customer Support

    Let us know

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