0

I have used some shortcodes for my few posts. You can see here on of the post I have included the shortcode. But when I am sharing this code to any social media it is not able to show the date. Right now I am using these codes you see below here.

add_filter( 'wpseo_title', 'do_shortcode' ); // activate shortcode in Yoast Title
add_filter( 'wpseo_metadesc', 'do_shortcode' ); // activate shortcode in Yoast Meta Description
add_filter( 'the_title', 'do_shortcode' ); // activate shortcode in WP Title
add_filter( 'og:title', 'do_shortcode' ); // activate shortcode in Yoast Title
add_filter( 'og:description', 'do_shortcode' ); // activate shortcode in Yoast Meta Description
// [todayfull]  
function todayfullday(){  
return date('l jS F Y');  
}  
add_shortcode('todayfullday', 'displaydate');  
// end date

In wrdpress there is no problem with this code and I can see the code working in search results too but the problem is there when I am sharing this post to social media sites.

0

in your function add_shortcode(,), the right way to do it is :

add_shortcode('displaydate','todayfullday ');

the name of the shortcode first , then the name of the callback function. https://developer.wordpress.org/reference/functions/add_shortcode/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.