Getting the ID of a meta box

Here’s what I would do in order to get the ID of the metabox, In the Dashboard where the meta boxed are located, open up the Screen Options tab on the upper right corner Open up your browser’s developer tool (ex: Chrome) Use the element selector () and select the checkbox label that is listed … Read more

How to get page’s ID if I know the title only?

I’m not sure how to get it via the title, but you can get it via the slug (which is often more useful in my experience) using this: http://erikt.tumblr.com/post/278953342/get-a-wordpress-page-id-with-the-slug Just change “$page” to “$post” if you want to return slugs for posts instead of pages. G’luck!

How to change WordPress user ID?

Why not make a new account for this user which will generate a new database ID. Then delete the user with the ID of 1 and attribute all posts / content to the new user you created for them? Then you don’t have to worry about queries or messing up your database. Also, as said … Read more

Get user id from email?

You are probably looking for the user_exists function. http://codex.wordpress.org/Function_Reference/email_exists This function will check whether or not a given email address ($email) has already been registered to a username, and returns that users ID (or false if none exists). If the email address does not exist (user_exists returns false), you may want to use the wp_create_user … Read more

How to add the category ID to admin page

The hooks for taxonomies are: “manage_edit-${taxonomy}_columns” for the header “manage_edit-${taxonomy}_sortable_columns” to make columns sortable “manage_${taxonomy}_custom_column” for the cell content To catch all taxonomies write: foreach ( get_taxonomies() as $taxonomy ) { add_action( “manage_edit-${taxonomy}_columns”, ‘t5_add_col’ ); add_filter( “manage_edit-${taxonomy}_sortable_columns”, ‘t5_add_col’ ); add_filter( “manage_${taxonomy}_custom_column”, ‘t5_show_id’, 10, 3 ); } add_action( ‘admin_print_styles-edit-tags.php’, ‘t5_tax_id_style’ ); function t5_add_col( $columns ) { … Read more

Get page id by title?

There is a function exactly for that: get_page_by_title( $page_title, $output = OBJECT, $post_type=”page” ); You can use it like this: $page = get_page_by_title( ‘Start’ ); To get the page from a specific post type: $custom = get_page_by_title( ‘Start’, OBJECT, ‘your_custom_post_type’ ); $post = get_page_by_title( ‘Start’, OBJECT, ‘post’ ); Be aware, this function will search in … Read more

Get ID of “root-page”

I think what you need is: <?php $post_id = $post->ID; //or somehow get the current post ID. $ancestors = get_post_ancestors($post_id) //$ancestors is an array of post IDs starting with the current post going up the root //’Pop’ the root ancestor out or returns the current ID if the post has no ancestors. $root_id = (!empty($ancestors) … Read more

Categories id Tags