2

If you wanted to do this for all post types, you'd simply do define('EMPTY_TRASH_DAYS', 0); see https://codex.wordpress.org/Trash_status#EMPTY_TRASH_DAYS_option. But since you only want to do this for a custom post type, you will need to hook into 'trashed_post', check your trashed posts' post types and do wp_delete_post() with the 'force delete' parameter ...


1

Is this a WordPress feature? Yes, and the redirect is being done by redirect_canonical(), but the URL is determined by redirect_guess_404_permalink(): redirect_guess_404_permalink() Attempts to guess the correct URL for a 404 request based on query vars. So what's happening in your case is, WordPress attempts to find a post having book in the slug (...


1

You have put these labels inside the capabilities argument, which is incorrect. They should be in labels argument. There is not edit_posts label, and you're missing most labels. There's many more labels you need to provide. They are listed here: https://developer.wordpress.org/reference/functions/get_post_type_labels/


1

One way is to adjust the TinyMCE settings: add_filter( 'tiny_mce_before_init', function( $settings ) { $settings['height'] = '120'; $settings['autoresize_max_height'] = '120'; return $settings; } ); and e.g. restrict further on post types and !block editor with get_current_screen(). Example: add_filter( 'tiny_mce_before_init', function( $...


1

You can insert custom style in the WP admin section via admin_head action hook. function wp123_set_editor_height() { ?> <style type="text/css"> /* For PAGE post type */ body.post-type-page #postdivrich #wp-content-editor-container iframe { height: 120px !important; } </style> <?php } add_action( '...


1

Your query args are not quite correct. When you want to order by a custom field, you need to specify a meta_key argument, and set your orderby to the kind of ordering you need. For example: $args = array( 'tax_query' => array( array( 'taxonomy' => 'topic', 'field' => 'slug', 'terms' => 'movie',...


1

SOLUTION: With some playing around I realized I am definitely an idiot and WAY over-thought things. While I had previously read and tried some of the things in this similar post, I ended up substituting their code for mine and found it actually worked for my use case. In trying to understand why that was, I began trying to convert it to become mine and ...


1

I managed to solve it using {$field_no_prefix}_save_pre with post_name. /** * Customize permalinks. * * @param string $post_name * * @return string * Returns a name-SKU combo for products, if all components are available. */ function my_custom_permalinks( $post_name ) { if ( ($_POST['post_type'] !== 'product') || ($_POST['...


Only top voted, non community-wiki answers of a minimum length are eligible