The code is tested and working fine.
Place this code
<?php
$posttags = get_the_tags();
if( ! empty( $posttags ) ) :
$tags = array();
foreach($posttags as $key => $value){
$tags[] = $value->name;
}
?>
<meta name="keywords" content="<?php echo implode( ',', $tags ); ?>,test"/>
<?php endif;?>
instead of
<meta name="keywords" content="<?php the_tags( '', ',', '' );?>test<?php }?>"/>
Related Posts:
- Actions, functions and conditionals
- if (is_page(**PAGE ID**)) not working
- how to check if front page is set to show a static page
- How can we use conditional tags in plugins?
- Conditional tag for all categories of a custom post type
- Possible to use conditionals within add_feed() callback?
- How to check if post has any tag?
- alt attributes not showing on pages
- Adding Controls to Theme Customizer If Certain Page Template is Active
- Problem with “conditional tag”: if empty
- is_singular() equivalent for backend
- Make specific tag visible only to logged in users in front-end
- How can I achieve something like has_post_format( ‘standard’ )?
- WordPress conditionals not working
- wp_head hook by page ID [closed]
- Limit Contact Form 7 hook to specific form [closed]
- Checking whether template part is loaded in a page
- Conditional tags inside a class
- How do I style WordPress pages differently based on the tag used?
- Display Footer Shortcode Different for Logged In Users
- If (category / tag checked) then (display header2php)
- If Parent or Current Page Is, Then Statement?
- Identify a Woocommerce page by WordPress conditional tags
- is_page conditional question
- using get_the_category to get all post categories except one
- A simple method for disabling WPML language switcher when meeting specific circumstances [closed]
- Display a div only in some author’s single posts
- Conditional check for embedded video in the_content
- Taxonomy Tag Conditionals
- is_front_page not working at all in any of the themes .php files
- is singular and is home not working
- If tag equals then show else show
- PHP if statement printing the if parameters
- Why is this is_page conditional not working?
- If page displays posts conditional
- How to check with is_page if 404.php is loaded?
- Sub-category single post styling?
- How to not display tags with less than X posts
- do code if current url = value
- Is there a reason I cannot get the current category in a loop?
- Why might conditionals not work on a page?
- Conditionals: What is wrong with my if/else statements? [closed]
- Only on single post page
- Is there any way to assign stylesheets to whole sets of pages using is_page( )
- is_home() returns true while it shouldn’t
- Filter for the Custom Post List Page
- Gravity Forms, multiple conditions in shortcode
- Can this code be concatenated?
- Conditonal tag or work around to identify page number of pagnation
- Conditional: current user updated post in the last X days
- page single conditional
- Is it possible to If statement “article already appears on page”?
- How to use the conditional homepage tag
- Which is the right order of the conditional tags on pages?
- Hide breadcrumbs on specific pages
- Pre Get Posts – Difference between conditional() and $query->conditional()?
- If less than IE9 [closed]
- Else statement not triggering after a failed if statement
- If tag exists, then echo once
- Custom Function for Portfolio Archive Template With Conditonal Tag
- Conditional Custom Image Header
- conditional statement for profile pages
- WP newbie: using else/if statements to show multiple headers. bonks
- Conditional Tags and Echo HTML / divs or CSS and Display: none?
- Detect tag page and include an Image for that specific tag
- Automatically insert H2 on h2 tags on WordPress post
- How to add Text before my Custom Term and hide it when empty
- Get value in TCPDF
- Add an identifier to a set of pages to access using a conditional tag
- How to target a search result page?
- method to fetch entire tag list on archive.php
- What changes are needed for this conditional code to work on deeper levels?
- How to detect if bbPress forum index
- Show all tags NOT applied to post
- showing tag beside catagory
- Displaying message if no posts in tag
- WordPress Conditionals Giving Me A Headache
- Auto-Tagging a Custom Post Type
- Conditional statements in wordpress themes
- My Conditional Tags not Working
- Conditional tag for attachment posts
- Is this a bad approach to add conditional comments to wp_head?
- Help with if else statement for separating content from image attachment
- Hide page header on both index and author pages [closed]
- How to check if the current page’s parent is one of 2 different ID’s
- Run a php function if a predefined page is visited
- Targeting all pages except top level pages
- nested conditional to check for feature image and custom field?
- is_archive for custom tax archive page?
- How to apply style to the body tag of a particular page?
- How to show only specific tag in wordpress loop
- Custom Headers on Blog Posts Page
- Conditional statement with three condition
- if is_page(‘slug’)
- How do I combine these two conditionals? [closed]
- Can’t seem to get an else statement correct? [closed]
- problem with not displaying content on selected pages
- hide block of code from showing on certain pages
- Delete backgound for ID with conditional if statement
- Quick Conditional Tag Question if elseif [closed]