Restrict custom post type to only site administrator role

register_post_type() accepts a parameter capabilities in its arguments. See get_post_type_capabilities() for possible values. From the comments: By default, seven keys are accepted as part of the capabilities array: edit_post, read_post, and delete_post are meta capabilities, which are then generally mapped to corresponding primitive capabilities depending on the context, which would be the post being edited/read/deleted … Read more

How to use my own custom session value in WordPress?

EDIT: “THE PLUGIN BELOW ISN’T AVAILABLE ANYMORE, SO PLEASE USE THAT PLUGIN INSTEAD: WordPress Session Plugin“ There is a good WordPress Plugin adapted from CodeIgniter Session class: WP Sessions Plugin. When you activate the plugin, you can start to use $session object from anywhere in your theme ($session object as long as global). For instance, … Read more

What does setup_postdata ($post ) do?

Template tag functions rely on global variables to access the post being processed and retrieve data from it or related to it. The main variable among these is $post, which holds the post object itself. In your example it’s not explicit, but what is happening is that your loop assigns data to $post. If its … Read more