Fatal error when custom variable callback function does not exist
-
Hello,
when the callback function for a custom variable does not exist, there is an error that doesn’t allow me to edit my post. Elementor just says “preview couldn’t be loaded”
I knew the problem was this custom variable but I couldn’t remove it from the seo title because I couldn’t access the page.
I thought the function “rank_math_register_var_replacement” should have a different behavior when the callback function does not exist so that users can keep on editing the page (removing the variable).
This is not a support question but I thought I would share this and maybe this is helpful.
Here is the stack trace if you need it.
Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, function "price_replace_callsback" not found or invalid function name in /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-variable.php:188 Stack trace: #0 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-variable.php(188): call_user_func('price_replace_c...', Array, Object(stdClass)) #1 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-replacer.php(288): RankMath\Replace_Variables\Variable->run_callback(Array, Object(stdClass)) #2 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-replacer.php(171): RankMath\Replace_Variables\Replacer->get_variable_value(Array, 1, 'price_replace') #3 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/replace-variables/class-replacer.php(97): RankMath\Replace_Variables\Replacer->set_up_replacements('%title% registr...') #4 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/class-helper.php(45): RankMath\Replace_Variables\Replacer->replace('%title% registr...', Object(WP_Post), Array) #5 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/class-metadata.php(144): RankMath\Helper::replace_vars('%title% registr...', Object(WP_Post)) #6 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/class-metadata.php(108): RankMath\Metadata->maybe_replace_vars('title', '%title% registr...', Object(WP_Post)) #7 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/class-post.php(94): RankMath\Metadata->get_metadata('title', '') #8 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-singular.php(131): RankMath\Post::get_meta('title', 12992) #9 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-singular.php(38): RankMath\Paper\Singular->get_post_title(Object(WP_Post)) #10 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-paper.php(156): RankMath\Paper\Singular->title() #11 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/frontend/class-head.php(177): RankMath\Paper\Paper->get_title() #12 /var/home/domain.tld/www/wp-includes/class-wp-hook.php(308): RankMath\Frontend\Head->title('') #13 /var/home/domain.tld/www/wp-includes/plugin.php(205): WP_Hook->apply_filters('', Array) #14 /var/home/domain.tld/www/wp-includes/general-template.php(1168): apply_filters('pre_get_documen...', '') #15 /var/home/domain.tld/www/wp-includes/general-template.php(1292): wp_get_document_title() #16 /var/home/domain.tld/www/wp-includes/class-wp-hook.php(308): _wp_render_title_tag() #17 /var/home/domain.tld/www/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #18 /var/home/domain.tld/www/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #19 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/traits/class-hooker.php(88): do_action_ref_array('rank_math/head', Array) #20 /var/home/domain.tld/www/wp-content/plugins/seo-by-rank-math/includes/frontend/class-head.php(156): RankMath\Frontend\Head->do_action('head') #21 /var/home/domain.tld/www/wp-includes/class-wp-hook.php(308): RankMath\Frontend\Head->head('') #22 /var/home/domain.tld/www/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #23 /var/home/domain.tld/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #24 /var/home/domain.tld/www/wp-includes/general-template.php(3043): do_action('wp_head') #25 /var/home/domain.tld/www/wp-content/themes/theme/header-single.php(24): wp_head() #26 /var/home/domain.tld/www/wp-includes/template.php(785): require('/var/home/fotok...') #27 /var/home/domain.tld/www/wp-includes/template.php(718): load_template('/var/home/fotok...', false, Array) #28 /var/home/domain.tld/www/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #29 /var/home/domain.tld/www/wp-content/themes/theme/header.php(12): get_template_part('header-single') #30 /var/home/domain.tld/www/wp-includes/template.php(783): require_once('/var/home/fotok...') #31 /var/home/domain.tld/www/wp-includes/template.php(718): load_template('/var/home/fotok...', true, Array) #32 /var/home/domain.tld/www/wp-includes/general-template.php(48): locate_template(Array, true, true, Array) #33 /var/home/domain.tld/www/wp-content/themes/theme/inc/mods/compatibility/elementor/page-templates/elementor-page.php(19): get_header() #34 /var/home/domain.tld/www/wp-includes/template-loader.php(106): include('/var/home/fotok...') #35 /var/home/domain.tld/www/wp-blog-header.php(19): require_once('/var/home/fotok...') #36 /var/home/domain.tld/www/index.php(17): require('/var/home/fotok...') #37 {main} thrown
- The topic ‘Fatal error when custom variable callback function does not exist’ is closed to new replies.