exclude category from WordPress Form function

What about using the exclude array key in your get_categories() call? e.g. change this: $massive_categories_obj = get_categories(‘hide_empty=0’); to this: $massive_categories_obj = get_categories(‘hide_empty=0&exclude=14’); Note that exclude expects a comma-separated string as a value. For your second function, what are you passing as $exclude? function retrieve_cat_data_sp( $exclude ){ $args = array( ‘hide_empty’ => ‘0’, ‘exclude’ => $exclude … Read more

How to get new post URL?

admin_url(‘post-new.php’); The admin_url function will handle generating most of the link, you just need to give it the final component. You can pass in GET parameters as well. Just look at the backend URL to see what you need. admin_url(‘post-new.php?post_type=page’); Or using add_query_arg as suggested by @Rarst … add_query_arg(array(‘post_type’=>’page’),admin_url(‘post-new.php’)); It is overkill for simple URLs … Read more

Unregister Nav Menu with fallback?

You can filter ‘wp_nav_menu_args’, set an invalid theme_location and the magic function __return_false as fallback: add_filter( ‘wp_nav_menu_args’, ‘override_parent_args’ ); function override_parent_args( $args ) { if ( ‘header-menu’ === $args[‘theme_location’] ) { $args[‘fallback_cb’] = ‘__return_false’; $args[‘theme_location’] = ‘ticky_tacky’; } return $args; }

Displaying a random user with a shortcode

By default WordPress allow only order ASC and DESC. However, you can use WP_User_Query and the action pre_user_query to adjust the query (that is passed by reference) just like you want. This is efficient because you get only one user, not all. function my_user_by_rand( $ua ) { // remove the action to run only once … Read more