the simple solution would be to paste this snippet of code in your theme’s functions.php file :
add_action('wp_head','keywords_and_desc');
function keywords_and_desc(){
global $post;
if (is_single()||is_page()){
if(get_post_meta($post->ID,'my_keywords',true) != '')
echo '<meta content="'.get_post_meta($post->ID,'my_keywords',true).'" name="keywords">';
if(get_post_meta($post->ID,'my_description',true) != '')
echo '<meta content="'.get_post_meta($post->ID,'my_description',true).'" name="description">';
}
}
And the just add keywords and description using the built in custom fields on a new/edit post/page screen, name the keywords field my_keywords
and the description field my_description
.
or you can use a very lightweight and simple plugin called Simple Meta Tags
Related Posts:
- ajax delete value from custom field array
- Let’s Create Custom Field Template Documentation
- Best way to achieve multiple links in a post title
- When post is updated, custom metadata in text area field is overwritten
- Adding custom fields to images
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Custom post meta field effect on the performance on the post
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- What is “meta_input” parameter in wp_insert_post() used for?
- How to enable revisions for post meta data?
- Add custom objects/entities to WordPress
- Can I count the number of users matching a value in a multiple value key?
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- Filter results with custom field values and dropdown
- Get updated meta data after save_post hook
- Ordering posts by anniversary using only day and month
- Adding Properties to User Profile and Displaying in List
- How to break meta values into different items and avoid duplicates?
- How to use pagination with get_post_meta
- How do I read the value of a custom field of the page?
- Custom fields: In what order are they saved into the DB?
- get_post_meta in sitewide tags plugin fails to return value for custom fields
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- MySQL query to set wp_postmeta using term_taxonomy_id value
- Insert attachment ID in custom field from media uploader
- How to Validate Post Meta type/extension (Video File Image File etc)
- Custom Meta Box not Saving in Posts with Gutenberg Editor
- Buddypress Add unserialized Profile Fields in Members Loop [closed]
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- How to wrap meta values seperated by comma in ? [closed]
- Bulk remove post meta
- How to create html block to display extra information on woocommerce single product page
- Better Method for Multiple Meta Boxes
- Run a check for multiple meta key values
- query usermeta from custom field
- custom avatar removal
- WordPress Rest API to call page data associate with custom meta
- Send email with custom fields after new draft is saved or new post published
- Hide custom meta data if empty
- How to create a shortcode to print specific values stored in a post meta array?
- Add custom field to all posts in specific post_type
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- Custom WP_Query for WordPress Search Results with meta_query
- How can you include custom post meta in search without calling each key?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- Customize rel=canonical tag for single blog post
- Get all the posts where meta field with multiple choice has several values checked
- wordpress custom loop ascending descending posts by custom field
- How to validate select field in post meta?
- How to display childrens custom fields?
- Hide custom fields when empty
- Check & remove special characters in a field?
- Save all the post tags inside a custom field
- if in category but only with post meta
- How add multiple wp_editor_box to new post
- Update post meta custom field using block editor
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- Get YouTube video id from url in a custom field
- Related query shows same image in loop
- Why am I getting a “Call to member function format() on a non-object” error?
- Can’t Output get_post_meta?
- How can I output the custom fields wrapping with HTML
- Modify custom field from front end
- How to get all custom fields with some prefix in key?
- How to get custom image field of specific post id
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Custom Query: query by post custom meta data
- get_post_custom_values problem, please help
- Adding re-type email and check it if the email match
- Counting post fields
- update_post_meta not working well
- Custom meta fields and meta keys
- How to add a post’s view count into the WordPress API response
- Can’t set custom meta fields for a post
- Saving Custom Field that includes Quotation marks
- Query Posts based on custom field value
- Display Data From This Custom Media Upload Meta Box?
- Query postmeta values, and return multiple post_titles for common meta value
- custom field functionality
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- How to add an option to admin to add image that could be used as header?
- Custom Field: Display only if a specific key is selected outside the loop
- Show or hide lang=”ur” in main element
- Adding thumbnails for non-image attachments
- When editing a post with a custom meta box the values aren’t displaying correctly
- Hard Define Custom Field Value
- I would like to display different text on different pages
- add_post_meta insert null value into Database
- Add image custom attribute [closed]
- Retrieving custom field as shortcode
- Problem display
- Add fields to edit in custom widget
- save all acf options in one meta_value [closed]
- WP Query Args – search by meta_key or title