Last active
April 30, 2021 08:25
-
-
Save mihdan/c3c3575ab552089b111ee5f05631d62c to your computer and use it in GitHub Desktop.
Yoast SEO: register extra replacement to get content before read more tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( | |
'wpseo_register_extra_replacements', | |
/** | |
* Yoast SEO: register extra replacement to get content before read more tag | |
*/ | |
function () { | |
wpseo_register_var_replacement( | |
'%%read_more%%', | |
function () { | |
return wp_strip_all_tags( get_extended( get_post()->post_content )['main'] ); | |
}, | |
'advanced', | |
'Get content before read more tag' | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment