Starting with an example makes more sense, so here’s an example function:
function seo_meta_tags() {
global $post;
if( is_singular() ) {
setup_postdata( $post );
$description = str_replace( '... <a class="read-more" href="' . get_permalink() . '">Cont. reading →</a>', '...', get_the_excerpt() );
wp_reset_postdata();
echo '<meta itemprop="description" name="description" content="' . $description . '">';
}
}
NOTE: The code is only to give you an idea of what I am trying to accomplish and not exactly how I am doing it.
Now coming to the point, should setup_postdata( $post )
be closed with wp_reset_postdata()
as shown in the example?