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'm trying to get the page parent dropdown (in page attributes) to show only pages that have been published by the author of the current page.

This doesn't seem to work :

add_filter( 'page_attributes_dropdown_pages_args', 'mwm_show_only_author_pages_in_attributes' );
add_filter( 'quick_edit_dropdown_pages_args', 'mwm_show_only_author_pages_in_attributes' );

function mwm_show_only_author_pages_in_attributes( $args ) {

    global $post;

    $args['author'] = $post -> post_author;

    return $args;
}

What am I doing wrong here ?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

From the source code the function wp_dropdown_pages uses get_pages() and this function uses different attributes than WP_Query or get_posts(). It uses authors instead of author.

Note from the codex:

authors (string) Only include the Pages written by the given author(s) Note: get_posts() uses the parameter 'author' instead of 'authors'.

share|improve this answer
    
Thanks david, I should really look at the source more often. –  mike23 Mar 14 '13 at 11:31
    
No problem, glad to help you. –  david.binda Mar 14 '13 at 12:04
add comment

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.