-
Dear Rankmath Team,
I want to change og:type from article to website for some of the posts in my website. Please help me.
- This topic was modified 4 years, 8 months ago by Xdeveloper.
-
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
Thank you for contacting Rank Math today.
I can suggest that you make use of the following filter to update the OG:type on the pages:
/** * Allows theme developers to change the OpenGraph type of the page. * * @param string $type The OpenGraph type string. */ add_filter( 'rank_math/opengraph/type', function( $type ) { if(is_page('page_id_here')){ return "Website"; } return $type; });
You will need to add the page id on the function and then add this code to your theme’s functions.php file.
Looking forward to helping you. Thank you.
@Michael Davis Thanks for the reply.
I want this change not only for pages. I want this for posts and entire website.
And also i want to remove below tags
<meta property=”article:published_time” content=”2020-04-03T12:31:10+00:00″>
<meta property=”article:modified_time” content=”2020-04-04T15:58:33+00:00″>
<meta property=”og:updated_time” content=”2020-04-04T15:58:33+00:00″>Please guide me.
- This reply was modified 4 years, 8 months ago by Xdeveloper.
Hello,
You can modify the previous code we gave you to override type in all pages (including posts and the entire website), just with this modification:
/** * Allows theme developers to change the OpenGraph type of the page. * * @param string $type The OpenGraph type string. */ add_filter( 'rank_math/opengraph/type', function( $type ) { return "Website"; });
Looking forward to helping you. Thank you.
- This reply was modified 4 years, 8 months ago by Alberto.
@Alberto Thanks for the reply.
How to remove below properties from my entire website.
<meta property=”article:published_time” content=”2020-04-03T12:31:10+00:00″>
<meta property=”article:modified_time” content=”2020-04-04T15:58:33+00:00″>
<meta property=”og:updated_time” content=”2020-04-04T15:58:33+00:00″>Hello,
You can remove them with this code:
add_filter( "rank_math/opengraph/facebook/og_updated_time", function($content) { return false; }); add_filter( "rank_math/opengraph/facebook/article:published_time", function( $content ) { return false; }); add_filter( "rank_math/opengraph/facebook/article:modified_time", function( $content ) { return false; });
Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
I added below code in functions.php but didn’t worked
`add_filter( “rank_math/opengraph/facebook/og_updated_time”, function($content) {
return false;
});
add_filter( “rank_math/opengraph/facebook/article:published_time”, function( $content ) {
return false;
});
add_filter( “rank_math/opengraph/facebook/article:modified_time”, function( $content ) {
return false;
});Thank you.
- This reply was modified 4 years, 8 months ago by Xdeveloper.
Hello,
Thank you for contacting Rank Math today.
I’ve just tested the code shared by my colleague and it works to remove the og_updated_time but you may have to update the rest of the code to the following:
add_filter( "rank_math/opengraph/facebook/og_updated_time", function($content) { return false; }); add_filter( "rank_math/opengraph/facebook/article_published_time", function( $content ) { return false; }); add_filter( "rank_math/opengraph/facebook/article_modified_time", function( $content ) { return false; });
Looking forward to helping you. Thank you.
Worked. Thank you so much.
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/#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.
You must be logged in to reply to this ticket.