-
I’m having trouble figuring out how to use the SEO filters, specifically the one to change specific open graph social media tags:
add_filter( "rank_math/opengraph/{$network}/$og_property", function( $content ) {
return $content;
});I was hoping you could give me a code snippet to demonstrate its use.
I currently have the og:image working for a custom URL that I insert with the filter for adding an attachment URL, but I was trying to add a few extra properties to it (width, height and type).
This is an example of what I was trying to do with this filter but was not having any luck:
// add width for facebook
add_filter( "rank_math/opengraph/facebook/image/width", function( $content ) {
global $post;if ( ( is_single( $post->ID ) or is_page( $post->ID ) ) and ( !has_post_thumbnail( $post->ID ) ) ){
$content = '1200';
return $content;
}});
Thanks in advance for any tips you might be able to provide!
The ticket ‘SEO Filters’ is closed to new replies.