Get Post ID when queried using author ID
-
I have one registration form and once user is registered, I have created an user and created new post in Custom Post type where I have passed/assigned newly created User ID to that post. This works fine.
Now I want users to edit their post from frontend and I have added few custom fields to save various data. So now, in order to edit their data specially for custom fields, I need that post ID.
I used get_posts and even WP_Query to get post added by particular author ID, I get data but I want post ID of that post that they are editing. Right now I am not getting that and due to that I am not able to update my custom fields.
Author ID is 40 and post ID is 355 (I checked from admin panel)
$args = array( 'author' => $author_id, 'orderby' => 'post_date', 'order' => 'ASC', 'post_type' => 'search_doctors', 'posts_per_page' => 1 ); get_posts($args);
Author ID is correct. Need help on getting post ID. Thanks in advance.
- The topic ‘Get Post ID when queried using author ID’ is closed to new replies.