PHP Fatal error
-
Could you please investigate this issue and verify why the callback is receiving a WP_Post_Type object instead of a WP_Term? It appears the filter is being triggered in a context where the second argument is not a term, which leads to the fatal error.
It would also be helpful if you could add the necessary type checks or fallbacks inside filter_course_category_term_link() to prevent the function from throwing a fatal error when unexpected data is passed. This would safeguard the site against similar failures in the future.
Please advise on next steps or provide a patch.
[17-Nov-2025 17:17:38 UTC] PHP Fatal error: Uncaught TypeError: TUTOR\Course_Filter::filter_course_category_term_link(): Argument #2 ($term) must be of type WP_Term, WP_Post_Type given, called in /var/www/vhosts/…/httpdocs/wp-includes/class-wp-hook.php on line 324 and defined in /var/www/vhosts/…/httpdocs/wp-content/plugins/tutor/classes/Course_Filter.php:338
Stack trace: 0 /var/www/vhosts/…/httpdocs/wp-includes/class-wp-hook.php(324): TUTOR\Course_Filter::filter_course_category_term_link() 1 /var/www/vhosts/…/httpdocs/wp-includes/plugin.php(205): WP_Hook->apply_filters() 2 /var/www/vhosts/…/httpdocs/wp-includes/taxonomy.php(4744): apply_filters() 3 /var/www/vhosts/…/httpdocs/wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-taxonomy.php(105): get_term_link() 4 /var/www/vhosts/…/httpdocs/wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-paper.php(372): RankMath\Paper\Taxonomy->canonical() 5 /var/www/vhosts/…/httpdocs/wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-paper.php(354): RankMath\Paper\Paper->generate_canonical() 6 /var/www/vhosts/…/httpdocs/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-post-variables.php(577): RankMath\Paper\Paper->get_canonical() 7 /var/www/vhosts/…/httpdocs/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-post-variables.php(108): RankMath\Replace_Variables\Post_Variables->get_url() 8 /var/www/vhosts/…/httpdocs/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-manager.php(119): RankMath\Replace_Variables\Post_Variables->setup_post_variables() 9 /var/www/vhosts/…/httpdocs/wp-includes/class-wp-hook.php(324): RankMath\Replace_Variables\Manager->setup() 10 /var/www/vhosts/…/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() 11 /var/www/vhosts/…/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action() 12 /var/www/vhosts/…/httpdocs/wp-includes/class-wp.php(835): do_action_ref_array() 13 /var/www/vhosts/…/httpdocs/wp-includes/functions.php(1342): WP->main() 14 /var/www/vhosts/…/httpdocs/wp-blog-header.php(16): wp() 15 /var/www/vhosts/…/httpdocs/index.php(17): require(‘…’) 16 {main}thrown in /var/www/vhosts/…/httpdocs/wp-content/plugins/tutor/classes/Course_Filter.php on line 338
The topic ‘PHP Fatal error’ is closed to new replies.