[wp-hackers] Auto creating custom menu
Tom Barrett
tcbarrett at gmail.com
Thu Nov 17 15:57:06 UTC 2011
Hi Christian,
The problem is that it won't add the pages to the menu, unless I am logged
>> in. Most likely this is me falling foul of the 'edit_posts' capability
>> again.
>>
>
> Then how about forcing a login before you call do_action(
> 'setup_wordpress' )?
> Something like...
>
> $user = get_userdatabylogin( $username );
> if ( is_object( $user ) ) {
> // login procedure
> wp_set_current_user( $user->ID, $username );
> wp_set_auth_cookie( $user->ID );
> do_action( 'wp_login', $username );
> }
>
Abso-super-smashing-great. Thank you, works a treat.
--
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett
More information about the wp-hackers
mailing list