schemify icon indicating copy to clipboard operation
schemify copied to clipboard

`get_the_excerpt()` getting called with null instead of post ID

Open morganestes opened this issue 6 years ago • 1 comments

When a search results page gets loaded with title and excerpt for each of the results, the debugger throws an error about a deprecated argument. This is caused by Thing::getDescription() passing false as the $post_id, which triggers a call to _deprecated_argument() inside get_the_excerpt(). I'm not sure what part is actually generating the post ID for the arg, but I've included the call stack here to see if someone else can help identify where it's happening.

Best I can tell, it all starts with append_to_footer(), which tries get_the_ID() but that fails and returns false. This just keeps getting passed down the line; even future calls to check it fail because they're using get_the_ID() which has already decided there isn't one to give.

( ! ) Notice: get_the_excerpt was called with an argument that is <strong>deprecated</strong> since version 2.3.0 with no alternative available. in /app/public/wp-includes/functions.php on line 4026
--
1 | 0.0043 | 364256 | {main}( ) | .../index.php:0
2 | 0.1128 | 365424 | require( '/app/public/wp-blog-header.php' ) | .../index.php:17
3 | 0.3119 | 3633768 | require_once( '/app/public/wp-includes/template-loader.php' ) | .../wp-blog-header.php:19
4 | 0.3129 | 3635152 | include( '/app/public/wp-content/themes/connect-base/search.php' ) | .../template-loader.php:74
5 | 0.3296 | 3697424 | get_footer( ??? ) | .../search.php:65
6 | 0.3296 | 3697800 | locate_template( ???, ???, ??? ) | .../general-template.php:84
7 | 0.3296 | 3697880 | load_template( ???, ??? ) | .../template.php:647
8 | 0.3299 | 3698112 | require_once( '/app/public/wp-content/themes/connect-base/footer.php' ) | .../template.php:688
9 | 0.3299 | 3698112 | wp_footer( ) | .../footer.php:9
10 | 0.3299 | 3698112 | do_action( ???, ??? ) | .../general-template.php:2605
11 | 0.3299 | 3698488 | WP_Hook->do_action( ??? ) | .../plugin.php:453
12 | 0.3299 | 3698488 | WP_Hook->apply_filters( ???, ??? ) | .../class-wp-hook.php:323
13 | 0.3299 | 3699616 | Schemify\Theme\append_to_footer( ??? ) | .../class-wp-hook.php:298
14 | 0.3300 | 3699616 | Schemify\Core\get_json( ???, ??? ) | .../theme.php:91
15 | 0.3300 | 3699616 | Schemify\Core\build_object( ???, ??? ) | .../core.php:132
16 | 0.3302 | 3700544 | Schemify\Schemas\Thing->getProperties( ) | .../core.php:46
17 | 0.3302 | 3700544 | Schemify\Schemas\Thing->build( ???, ??? ) | .../Thing.php:98
18 | 0.3302 | 3701936 | Schemify\Schemas\Thing->getProp( ??? ) | .../Thing.php:183
19 | 0.3302 | 3702256 | Schemify\Schemas\Thing->getDescription( ??? ) | .../Thing.php:135
20 | 102.5890 | 3708744 | get_the_excerpt( ??? ) | .../Thing.php:257
21 | 102.5890 | 3708744 | _deprecated_argument( ???, ???, ??? ) | .../post-template.php:376
22 | 102.5891 | 3709064 | trigger_error ( ??? ) | .../functions.php:4026

morganestes avatar Sep 11 '17 19:09 morganestes

Hey @morganestes, thanks for the report! Schemify is due for an update, and I'll be sure to look into this!

stevegrunwell avatar Oct 24 '17 17:10 stevegrunwell