Remove name property from Schema

add_filter( ‘aioseo_schema_output’, ‘aioseo_filter_schema_output’ ); function aioseo_filter_schema_output( $graphs ) { if ( false === strpos( $_SERVER[‘REQUEST_URI’], ‘home-search/listing/’ ) ) { return $graphs; } foreach ( $graphs as $index => $graph ) { if ( isset( $graphs[ $index ][‘name’] ) ) {…Continue reading

Replace all the URLs in the Schema with the current URL

add_filter( ‘aioseo_schema_output’, ‘aioseo_schema_change_urls’ ); function aioseo_schema_change_urls( $graphs ) { if ( false === strpos( $_SERVER[‘REQUEST_URI’], ‘home-search/listing/’ ) ) { return $graphs; } $request_uri = explode( ‘?’, $_SERVER[‘REQUEST_URI’] ); $uri = trim( ( $request_uri[0] ?? ” ), ‘/’ ); $old_url =…Continue reading

Exclude all matching URLs from Sitemap

add_filter( ‘aioseo_sitemap_posts’, ‘aioseo_sitemap_posts’ ); function aioseo_sitemap_posts( $entries ) { foreach ( $entries as $key => $entry ) { $postId = url_to_postid( $entry[‘loc’] ); if ( $postId && ( strpos($entry[‘loc’], ‘/member/’) ) ) { unset( $entries[ $key ] ); } }…Continue reading

Set current URL as the Canonical URL and ignore query strings

add_filter( ‘aioseo_canonical_url’, ‘aioseo_filter_canonical_url’ ); function aioseo_filter_canonical_url( $url ) { if (strpos($_SERVER[‘REQUEST_URI’],’/home-search/listing/’) !== false) { $url = home_url( $_SERVER[‘REQUEST_URI’] ); if (strpos($url,’?’) !== false){ $url = substr( $url, 0, strpos($url,’?’) ); } } return $url; }Continue reading

Limit Meta Description to 160 characters

add_filter( ‘aioseo_description’, ‘aioseo_filter_description’ ); function aioseo_filter_description( $description ) { if ( strlen($description) > 160 ) { $description = substr($description, 0, 159); } return $description; }Continue reading