• Resolved Sakshi Tyagi

    (@sakshityagi343)


    Hi,

    I’m creating a custom snippet variable in functions file. Based on the page URL parameter I need to pass this custom variable value in SEO Title. But its not working. Below is my code for your reference:

    function mgfh_seo_get_name_by_url_params() {
        $param = isset($_REQUEST['cusParam']) ? $_REQUEST['cusParam'] : '';
        return $param;
    }
    
    function mgfh_register_custom_yoast_variables() {
        wpseo_register_var_replacement( '%%param-name%%', 'mgfh_seo_get_name_by_url_params', 'advanced', 'Param Name' );
    }
    add_action('wpseo_register_extra_replacements', 'mgfh_register_custom_yoast_variables');

    Please help

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘URL parameter as custom variable in SEO Title’ is closed to new replies.