OG Meta Not Presenting

#6208
  • Resolved Tom
    Rank Math business

    Hello, it appears to be another Extra theme conflict. What is being presented in my source code is not how I have the meta set up in rankmath – Titles & Meta – Homepage

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Please add the following code to your theme’s functions.php file and let me know how it works for you:

    /**
     * Only load if Rank Math plugin is activated
     */
    if ( defined( 'RANK_MATH_FILE' ) && 'layout' === get_option( 'show_on_front' ) ) {
    
        /**
         * Adjusting homepage's title tag
         * @return string
         */
            function extra_rank_math_homepage_title_adjustment( $title ) {
                if ( is_home() ) {
                    $title = RankMath\Helper::replace_vars( RankMath\Helper::get_settings( 'titles.homepage_title' ) );
                }
                return $title;
            }
            add_filter( 'rank_math/frontend/title', 'extra_rank_math_homepage_title_adjustment', 16 );
    
            /**
             * Adjusting homepage's meta description
             * @return string
             */
            add_filter( 'rank_math/frontend/description', function( $description ) {
                if ( is_home() ) {
                    $description = RankMath\Helper::replace_vars( RankMath\Helper::get_settings( 'titles.homepage_description' ) );
                }
                return $description;
            });
    
            /**
             * Adjusting homepage's robots
             * @return string
             */
            add_filter( 'rank_math/frontend/robots', function( $robots ) {
                if ( is_home() && RankMath\Helper::get_settings( 'titles.homepage_custom_robots' ) ) {
                    $robots = RankMath\Helper::get_settings( 'titles.homepage_robots' );
                    if ( ! is_array( $robots ) || ! in_array( 'noindex', $robots ) ) {
                        $robots['index'] = 'index';
                    }
                    if ( ! is_array( $robots ) || ! in_array( 'nofollow', $robots ) ) {
                        $robots['follow'] = 'follow';
                    }
                }
                return $robots;
            });
    }

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Tom
    Rank Math business

    Worked perfectly sir. Thank you!

    Todd
    Rank Math free

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘OG Meta Not Presenting’ is closed to new replies.