Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Jonas Lundman on "Manipulating register_post_status() setup on pageload"

$
0
0

When register custom post status in my functions.php. Can I provide diffrent args for diffrent user views? Will this type of manipulating totally be "out of how to?". Ive been searching for an answer many months, but cant se anyone doing this, so I finally have to post it here.

Here is my code:

function my_custom_post_status(){

if(current_user_can( 'update_core')) $p = true;
    else $p = false;
register_post_status('archive', array(
    'label'                     => _x( 'Archive', 'post' ),
    'public'                    => $p,
    'exclude_from_search'       => true,
    'show_in_admin_all_list'    => true,
    'show_in_admin_status_list' => true,
    'label_count'               => _n_noop( 'Archive <span class="count">(%s)</span>', 'Archive <span class="count">(%s)</span>' )
));

}
add_action( 'init', 'my_custom_post_status' );

This actually is working, but do I mess with the database or are this kind of register just a "page to page load" variables? ( I mean, "register", is it just instructions how to handle the "already stored" and "to be stored" in the database? )

Don ask why Im doing this (!), just if I can do it -or if Im making a mess...

Thanks to all of you who contributes on this forum !


Viewing all articles
Browse latest Browse all 8245

Trending Articles