I think you have to check if the loaded page is a post, and use the WordPress loop to get the right data.
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post(); ?>
<meta name="author" content="<?php the_author(); ?>" >
<meta name="description" content="<?php the_content(); ?>" >
<?php
}
}
?>
Related Posts:
- Clean up output added via wp_head()
- Does post-meta belong in header?
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
- Sanitizing integer input for update_post_meta
- if get_post_meta is empty do something
- Meta compare with date (stored as string) not working
- How to update/insert custom field(post meta) data with wordpress REST API?
- Front-end update_post_meta snippet displays white screen?
- How to get meta value in wp_attachment_metadata
- Can’t translate the post meta data (Date) in another language
- get_post_custom()
- Get post from meta_key and meta_value
- get_post_meta returns bool(false)
- How to get custom post type to display post meta on archive pages?
- WP_POSTMETA changes site crash
- meta_post_meta return value 1
- How to use post_id with a Class?
- get_post_meta remains empty while looping all menu items and using the ID
- Set default Custom Post Meta Value
- How to stop wp_postmeta from being called on archive and search pages?
- INSERT ON DUPLICATE KEY UPDATE failes in postmeta table
- Set Checkbox as checked by default
- running function during post save and adding variable to post meta
- replacing the_autor or make callback
- Some post meta fields stop saving after a few successful saves
- Save an array of values in the post meta box
- Custom post meta values reset by autosave [duplicate]
- Compare meta_query with a Regular Expression and do a less-than operation on it
- get_post_meta() empty in preview WHEN custom post is published [closed]
- Add Embed.ly API objects to post_meta on update
- Editing does not change post_name
- Compare string with post id in wpdb and do stuff when match is found
- $wpdb class updating meta_value using Ajax [closed]
- cleaning up safely wordpress wp_postmeta table
- How to selected which tags to print, instead of printing the whole tag list?
- Why does get_transient() always return string even if integer set?
- Author_meta ONLY if it exists
- query posts and split meta information into separate div’s
- How to test the outcome of a wpdb query?
- add unique string as custom-field to every post
- How do I insert a new meta key / value pair, but only if another meta key is present?
- “Cannot use import statement outside a module” JS error while adding a custom meta block?
- Gutenberg featured image checkbox – checkbox not correctly set on editing page reload
- How to properly use oneOf and anyOf in Rest Schema?
- Get the author meta adds now
- wordpress is_front_page() issue
- Retrieve user_meta and copy to post_meta
- update_post_meta not working?
- Change wordpress meta tag description using WP functions
- Cant create or update meta fields using WordPress REST API
- Filter posts by meta key
- Display current ranking of post as a number in post title
- delete duplicates wp_postmeta
- Post Thumbnail missing when using webp format while sharing
- How to merge the array values in foreach?
- Bulk Update Post Meta Values from Different Post via Rest Api
- update_post_meta() is not saving the value
- Only show meta on one post type on search results page
- How to register post meta with multi level arrays?
- How to exclude posts by meta key value in the_post_navigation next prev links?
- If I disable screen options, does WP still try to update post meta?
- update_post_meta not working with transition_comment_status
- Can we have duplicate key pair values in post meta data?
- I created a Custom Meta Box but it is not displaying the value on my post page
- Meta data being pulled from wp-login.php
- Attachment metadata has value of ‘1’
- Get post content before rendering
- wp_insert_post inside save_post adds wrong metadata to inserted post
- Rename image filename using ‘media_handle_upload’
- How do I update a specific value within array in a products metadata?
- Update Post metafield of specific categories
- Optimize WP Meta Query for large amount of post meta?
- rendering open graph meta tags in wordpress
- Using Self Hosted Video URL With Custom Fields
- Multiple postmeta values to the same post_id/meta_key combination?
- get_post_meta not work in php foreach
- Restore deleted _thumbnail_id in postmeta table
- Why are my custom metaboxes not updating the post meta?
- Problem serializing single quote and double quote into post meta
- Storing post_meta fields in array
- Performace on 1 million plus meta fields vs 1 field with 1 million multi array
- Hide the_meta if no value
- Fetching array of postmeta with $wpdb and in_array conditional
- Piklist File Upload
- php wp_insert data on front using a form
- Updating post_meta when updating a setting with the Settings API
- How to show specific meta keys of all posts in admin panel?
- how to echo/display the custom field value in specific custom field name?
- update_post_meta() not working in bulk option
- How to update the ‘modified_time’ of a post ONLY when content is changed?
- Media library orphans
- Multiple If else statements on Search Result Page
- How to make certain content of the post noindex and no follow. not entire post?
- get_children filter with postmeta
- Auto save title as custom meta field value
- How to show wordpress post in the site based on custom field value?
- wordpress query making site very slow
- if condition from post_meta not working in save_post
- Extend file format support for post thumbnails