Change upload_dir folder at a certain cpt but cant change back

I found! this will only change the upload dir when upload in the “rsg_download” CPT add_filter( ‘wp_handle_upload_prefilter’, ‘rsg_pre_upload’ ); function rsg_pre_upload( $file ) { add_filter( ‘upload_dir’, ‘rsg_custom_upload_dir’ ); return $file; } function rsg_custom_upload_dir( $param ) { $id = $_REQUEST[‘post_id’]; $parent = get_post( $id )->post_parent; if( “rsg_download” == get_post_type( $id ) || “rsg_download” == get_post_type( $parent … Read more

Change Post Title Edit Box

You can add following code to your functions.php in the Theme-folder. Change the Custom Post Type(movie) name and the title to your wishes. function wpse213979_new_title_text( $title, $post ){ if ( ‘movie’ == $post->post_type ) { // Movie is the cpt name $title=”Enter movie name”; // The text you want to be shown } return $title; … Read more

Registering post type is not adding to admin menu

Remove ‘capability_type’ => array(‘slide’, ‘slides’), This works add_action( ‘init’, ‘slides_post_type’ ); function slides_post_type() { register_post_type( ‘Slides’, array( ‘labels’ => array( ‘name’ => __(‘Slides’, ‘bonestheme’), ‘singular_name’ => __(‘Slide’, ‘bonestheme’), ‘add_new_item’ => __(‘Add New Slide’, ‘bonestheme’), ‘edit_item’ => __(‘Edit Slide’, ‘bonestheme’), ‘new_item’ => __(‘New Slide’, ‘bonestheme’), ‘view_item’ => __(‘View Slide’, ‘bonestheme’), ‘search_items’ => __(‘Search Slides’, ‘bonestheme’), ‘not_found’ … Read more

Change / Delete the default post type and category?

Yes this is possible with a very simple solution. Add this code snippet to your theme’s funtion.php add_action(‘admin_menu’,’remove_default_post_type’); function remove_default_post_type() { remove_menu_page(‘edit.php’); } More info: https://www.techjunkie.com/remove-default-post-type-from-admin-menu-wordpress/ or https://codex.wordpress.org/Function_Reference/remove_menu_page

How to query custom post type by term?

You cannot make up your own arguments – rather than replacing the ‘category’ argument with your taxonomy name, use ‘tax_query’. See “taxonomy parameters” section of the codex on get_posts. $args = array( ‘post_type’ => ‘event’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘eventcategory’, ‘field’ => ‘slug’, ‘terms’ => ‘nice-events’, ), ), ); $your_query … Read more