To get post meta fields, you can use get_post_meta()
function, but obviously not get_user_meta()
, the name of the functions are self-explanatory.
The first parameter of get_post_meta()
function is the post ID; here you define which post you want to get postmeta from. So, you need to get frist the post ID of the post you want and then pass this ID to get_post_meta()
.
For example, you can get the posts from author with ID 5, limit to “product” post type and then get the post meta for each found post. For example, using get_posts()
:
$args = array(
//Get all posts from author 5 and post type "product"
'author' => 5,
'post_type' = 'product',
'posts_per_page'=>-1
);
$posts = get_posts($args);
foreach($posts as $post) {
get_post_meta($post->ID, 'lt_content_design', true);
}
Related Posts:
- Show number of posts by logged in user
- How to check if post meta key exists or not in wordpress database
- Update post counts (published, draft, unattached) in admin interface
- How to add category to: ‘wp-admin/post-new.php’?
- How to Display a List of Users Who Have Made at Least 1 Post?
- Find out who deleted a page or post?
- How can I retrieve multiple get_post_meta values efficiently?
- Code to make a post sticky
- How to allow hidden custom fields to be added from wp-admin/post.php?
- Export WordPress Posts and Meta Information in CSV format
- WordPress: How to get the current logged in author page URL?
- Delete duplicated wp_postmeta record
- disable password protected page for logged users
- Will a large postmeta table slow a site down?
- Update all posts automatically when using post_meta
- How to batch update post content with custom post meta value
- Change slug with custom field
- Force “Submit to review” when a post is updated
- Better post meta efficiency?
- Setting post meta data to random value during post status transition / on publish
- Edit meta data does’t work with custom sql
- Overview with latest edited posts and pages
- Navigation link to specific user page
- Get how many days since last post of the current user
- Human Time Diff, change mins to minutes
- Change post format using custom field
- Hide comments awaiting moderation from user who submitted the comments
- Does WP get all post_meta on POST page?
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Query All users that has post
- Exporting Data from WordPress into a flat table
- Adding Multiple Values to a Post Meta Key
- Using radio button meta data from a custom meta box
- Limit number of posts a user can make per minute?
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- wp_insert_post let users post to without login…broke
- Get user’s most published categories
- Allow anonymous users to post to my site for moderation
- PHP Notice error (when on 404 page)
- What Is meta_id In wp_postmeta?
- disable column on post and user list
- Checking if a post with certain meta value exists
- How to permanently delete a post meta entry?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- how to find user ids of all commenters in a post
- How to list users and their post amount?
- How to generate numbers indistinguishable for the IDs of the posts
- Is there any way to allow users to access content before it’s published?
- UberMenu list current user’s posts as menu items
- Modify WP_Post before processing
- Save re-arranged draggable post items to wordpress database
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Change post_date to post_modified date on post template?
- Create post for every user?
- count the total number of comments the user has received for his published posts
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Restrict users post for himself
- How to allow logged in users to post anonymously
- Allow public to post on blog
- How can I sort posts by the date and a custom meta field?
- is there a way to show the the post title after the image?
- Get Meta Key Value While Saving Post
- current post with current author
- How to verify wp user password by sql query in wp? [closed]
- Force the “Choose from the most used tags” meta box section to always be expanded
- Meta value does not save for scheduled posts
- Custom Posts Query and meta_query Sort Order
- How can i delay reading posing in 3days for not logined user?
- Encountering “Wrong nonce. Action prohibitied.” when trying to alter User Role and unable to Post via WP Admin
- How to compare two posts including their meta fields on a scalable base?
- Getting value from get_post_custom
- Users problem (multi-author plus multisite)
- Calling Different Custom Post Timestamps in a table
- Is it possible to paste a link without tags and make it directly a link in a post?
- Cannot retrieve a custom RSS field from posts
- Saving custom fields to a custom taxonomy
- How to automate featured posts number? [duplicate]
- How do I manage my users post before publish?
- How do I retrieve a users’ last 5 posts?
- Gather posts into a cart/lightbox and share with another user
- Customize rel=canonical tag for single blog post
- Change all author links in Blog roll
- How to I retrieve the ID from the Posts page?
- How to save meta checkbox WordPress
- Assign published posts to another user automatically
- How to calculate the average of a post meta value(Numeric) of a specific author
- Is there any way to tell when wp_postmeta has been updated?
- Add field to user meta table in database when link is clicked
- Hide comments and posts posted by other user
- Automatically create a default set of posts for each new registered user
- wpColorPicker – problem with implementation to post meta
- Summary of Posts by an User
- Change post author without using wp_update_post()
- Display a list of users who have viewed the post you are viewing
- if in category but only with post meta
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- wp_query with ajax
- Echo Text If User Is Logged in But NOT the Author of post
- Update post meta within save_post action
- Display post number by category