Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need a lil something done and I have looked over Google for and cant seem to find, not even a close solution.

My site is totally user front end with wp-admin being blocked by users. When a user logs in they are taken to a "dashboard".

Each person can only make one post. What i need is something to take the current logged in user and grab the post id of their post. so i can link to their edit page.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I am surprised that you didn't find references to the two components that you need. These are both extremely common.

$current_user = wp_get_current_user();
$query = new WP_Query( 
  array (
    'author' => $current_user->ID,
    'posts_per_page' => 1,
    'post_status' => array('any'),
  )
);
var_dump($query); // debug

Reference:

http://codex.wordpress.org/Function_Reference/wp_get_current_user
http://codex.wordpress.org/Class_Reference/WP_Query

share|improve this answer
    
I wasn't looking to make a loop just to pull in 1 id. Otherwise i would have. –  Noob Theory Jul 23 '13 at 4:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.