Home / Admin / Disable OpenGraph Tags on all Listing Detail Pages
Duplicate Snippet

Embed Snippet on Your Site

Disable OpenGraph Tags on all Listing Detail Pages

This snippet disables OpenGraph Tags on all pages whose URL contains /listing-detail/

<10
Code Preview
php
<?php
add_filter( 'aioseo_facebook_tags', 'aioseo_filter_remove_facebook_tags' );
function aioseo_filter_remove_facebook_tags( $facebookMeta ) {
    $uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
    if ( strpos( $uri, '/listing-detail/' ) !== false ) {
        return array();
    }
    return $facebookMeta;
}

Comments

Add a Comment