add tags keyworda as a meta keyword in each post head tag.

Posted in: Newspaper
Post count: 41

Please,

Guide me how to add each post tags keyword as a meta keyword in each post’s head section.

i tried but showing category keyword as a meta keyword. (By adding below function)

applied function:

function add_meta_tags() {
global $post;
if ( is_single() ) {
$meta = strip_tags( $post->post_content );
$meta = strip_shortcodes( $post->post_content );
$meta = str_replace( array(“\n”, “\r”, “\t”), ‘ ‘, $meta );
$meta = substr( $meta, 0, 125 );
$keywords = get_the_category( $post->ID );
$metakeywords = ”;
foreach ( $keywords as $keyword ) {
$metakeywords .= $keyword->cat_name . “, “;
}
echo ‘<meta name=”keywords” content=”‘ . $metakeywords . ‘” />’ . “\n”;
}
}
add_action( ‘wp_head’, ‘add_meta_tags’ , 2 );

right now, i am using wordpress SEO plugins.

want this for each post,
<meta name=”keywords” content=” wan’t current post tags comma separated in head section of each post”>

Post count: 22421

Hello,
Unfortunately the code will not work in it’s current state. However this request falls beyond what support can offer you. We recommend hiring a freelancer to help out in these cases if you really need this customization. Sorry, but we are a small team and time does not allow us to tackle such tasks. We try to help out where we can.
You can hire a freelancer from sites like studio.envato.com.
Thank you for your understanding.

Post count: 9544

You could create a query to print assigned categories from post using an “if single” query in the post header.php file into a manually set keywords meta tag in your header file.

<meta name="keywords" content="
{{PUT YOUR QUERY HERE FOR OUTSIDE LOOP}}
">

Post count: 41

Thanks Chris S for reply,

Bro, i want post tags not categories, Like all other websites showing in right way.

Please help little bit more,

So, how can i get tags as a meta keywords for each post given after post.

Please, give me code so i can place it in function file and fetch the correct result.

Only my site missing this meta keyword,

Thanks

Post count: 9544

Probably need to hire a programmer if you cant figure out how to echo/print list of tags into your meta field.

Keywords not that important anymore for the top 5 search engines. Not used by google, bing, etc.

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.