WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to allow user that Post option display on his dashboard. Where User's Can Show only his post. How I manage this. Please Help me.

share|improve this question
Please explain post option. – toscho May 5 '13 at 7:33

You seem to be asking 2 questions:

1) How do I place something on the Dashboard?

2) How do I get the links to all posts the current author has written?

One way to place something on the Dashboard is to use a Dashboard widget. The Dashboard Widgets API describes the details, but here is some code based on it.

add_action( 'wp_dashboard_setup', 'ckc_author_posts_dashboard_widget' );

 * This function runs when the 'wp_dashboard_setup' action is
 * called. It adds the widget and calls the function that that fills
 * the widget.
function ckc_author_posts_dashboard_widget() {
    wp_add_dashboard_widget( 'author_posts_dashboard_widget', __( 'Your Posts', 'theme_text_domain' ), 'ckc_author_posts' );

 *  This function displays the text in the 'author_posts_dashboard_widget'.
function ckc_author_posts() {
    // Display whatever it is you want to show
    echo "This is where the posts for this author will be displayed.";

Add that code to your functions.php theme file. 'theme_text_domain' should be replaced with the text domain for your theme, if you use one. Otherwise leave it as is.

You should end up with a new Dashboard Widget with the text "This is where the posts for this author will be displayed." in it.

To get a list of links for the Author's posts, run a query on the WordPress database. That sounds fancy and technical, but the information is written in (fairly) plain English in the WP_Query Object Reference. Here is the code I used to test for this answer.

 *  This function displays the text in the 'author_posts_dashboard_widget'.
function ckc_author_posts() {
    $current_user = wp_get_current_user();

    // This is the query. Change it to change which
    // posts appear in the while loop below.
    $author_posts = new WP_Query( array(
        'author' => $current_user->ID,
    ) );

    if ( $author_posts->have_posts() ) {

        echo '<ul>';

        while ( $author_posts->have_posts() ) {

                "<li><a href='%s'>%s</a> (<a href='%s'>Edit</a>)</li>\n",

        echo '</ul>';

    } else {
        echo 'No Post found.';

This produces a list of all posts by the current author and adds a link to edit the posts as well. I didn't test it thoroughly, but the query should grab all the posts by this author, published, unpublished, in the trash, etc. If you want something different, you should adjust the arguments in the WP_Query() call.

If you do not want the Edit link replace the printf() code with this:

                "<li><a href='%s'>%s</a></li>\n",
share|improve this answer
Not sure if the Question as it is deserves such an Answer. +1 for the nice write-up – brasofilo May 5 '13 at 22:51

Your Answer


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.