Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type

For a WordPress project I made a Custom Post Type in the usual manner. Also i made a custom role. I want users with that role to be able to make, edit and delete this CPT. I added the apropriate capabilities to this role. These are the caps:

'level_1' => true, // seems necessary to asign this author as a post_author by other users 'read' => true, 'view_admin_dashboard' => true, 'upload_files' => true, 'publish_{my_cpts}' => true, 'edit_{my_cpts}' => true, 'edit_others_{my_cpts}' => false, 'delete_{my_cpts}' => true, 'delete_others_{my_cpts}' => false, 'read_private_{my_cpts}' => true, 'edit_{my_cpt}' => true, 'delete_{my_cpt}' => true, 'read_{my_cpt}' => true 

I map these capabilities also in the args for adding the cpt. Upon making the CPT, I did not forget to add ‘thumbnail’ to the ‘supports’ argument. And i added theme-support for thumbnails, also for my cpt

However, i don’t want users with this role to be able to edit ordinary posts.

I think i don’t need to provide more details on this because everything works fine.

Except for the featured image panel in Gutenberg. This panel seems to display only if a user has the edit_posts capability, which my users don’t have. The panel shows for other users, it only remains hidden for users with my custom role.

For now, I made a workaround with an ACF-image field. Images uploaded with this custom field I make the featured-image in a save_post hook.

But this is a workaround, I prefer the usual panel. Any suggestions? I find this an unusual hard nut to crack.

Update post meta not working in transition_post_status

I am developing a plugin for custom post type which take the link from the title of the post and then after scraping on that link it updates all things like post title, post permalink and post_meta. Now its only updating the title and the link but not the post meta, I have tried debugging the data.

function a_new_post($  new_status, $  old_status, $  post) {      if ('publish' !== $  new_status or 'publish' === $  old_status)         return;     $  new_slug = sanitize_title($  post->post_title);     if ('aps-products' !== $  post->post_type)         return; // restrict the filter to a specific post type      $  result= getSpecs($  post->post_title);  /* ****************************************************************************** ****************************************************************************** ****************************************************************************** */ $  groups = get_aps_cat_groups(16); $  groups_data = get_aps_groups_data(); $  attrs_data = get_aps_attributes_data();  // get aps attributes data from input fields  foreach ($  groups as $  groupId) {     $  group_data = $  groups_data[$  groupId];     $  group_values = get_aps_product_attributes($  post->ID, $  groupId);      if ($  group_data['attrs']) {         if (aps_is_array($  group_data['attrs'])) {             $  first=array();             $  value='';             foreach ($  group_data['attrs'] as $  attr_id) {                 switch($  attr_id){                     case 20:                         $  value=$  result[1];                     break;                     case 21:                         $  value=$  result[12];                     break;                     case 22:                         $  value=$  result[3];                     break;                     case 24:                         $  value=$  result[13];                     break;                 }                 $  frist[$  attr_id]=$  value;             }             update_post_meta( $  post->ID, 'aps-attr-group-' .$  groupId, $  first );         }     } }    /* ****************************************************************************** ****************************************************************************** ****************************************************************************** */      $  post_update = array(         'ID'         => $  post->ID,         'post_title' => $  result[0].' '.$  result[1]     );     if (!wp_is_post_revision($  post->ID)) {         wp_update_post($  post_update);         $  new_slug = sanitize_title($  result[0].' '.$  result[1]);         if ($  post->post_name != $  new_slug) {             wp_update_post(                 array(                     'ID'        => $  post->ID,                     'post_name' => $  new_slug                  )             );         }     } } 

How to automatically set ‘default image size’ for specific Custom Post Type

I’m looking to automatically set the default image size in the WordPress WYSIWYG, but only on certain Custom Post Types. For example, my CPT ‘products’ would default to ‘medium’, and CPT ‘staff’ would default to ‘full’.

I’ve used the following code below to update media sizes for all CPT’s, not just a specific one. Is this possible?

Here is the code I’m using for site-wide definitions:

function custom_image_size() {   update_option('image_default_size', 'full' ); }  add_action('after_setup_theme', 'custom_image_size'); 

Best place to post 5e homebrew for feedback? [closed]

I have been searching around for the best places to post DnD 5e homebrew classes for feedback. I have already posted to r/DnDHomebrew and the Giant in the playground forums. Any help would be great.

As opposed to making two separate posts, here is the homebrew class any feedback on it would be excellent. There has been some playtesting done already and balancing based off of that. I am looking for feedback on balance and potential issues with it.

The class is the Slayer, a sort of cross between barbarian and paladin that runs off of Runes instead of spells and rage.

change the dropdown content of author post meta in edit post – admin

I am trying to customize the author meta box in the post edit page, as you all know this dropdown is using to assign a post to a corresponding author.

I would like to change the dropdown content. Like currently, its showing display name(username). But i would like to show a user meta field rather than username. Is it possible?

So in the dropdown it will be like Display name(custom user meta field).

I have seen wp_dropdown_users, but no idea how to use it so that i can achieve.

reference on relating Post systems to string rewriting systems and formal grammars?

wikipedia states:

Every Post canonical system can be reduced to a string rewriting system (semi-Thue system) […] It has been proved that any Post canonical system is reducible to such a substitution system, which, as a formal grammar, is also called a phrase-structure grammar, or a type-0 grammar in the Chomsky hierarchy

and on a different page:

A semi-Thue system is also a special type of Post canonical system, but every Post canonical system can also be reduced to an SRS.

I have not been able to find much explanation of these statements.

Is there a good reference that shows how to do conversions between these notions?

How to return/export only data showing on screen in custom post type view all screen

If I for example filter my custom post type by date and it only shows 2 records on screen, I only want to export those 2 records, but it is exporting a bunch of records out of my control ie: the wrong records.

How can I modify this to only export what is showing up on screen ie: the 2 records in this case?

add_action( 'init', 'func_export_some_records' ); function func_export_all_posts() {     if(isset($  _GET['export_some_records'])) {         $  arg = array(                 'post_type' => 'shirts',                 'fields' => 'ids'             );           global $  post;         $  arr_post = get_posts($  arg);         if ($  arr_post) {              header("Content-Description: File Transfer");             header("Content-Type: application/csv");             header('Content-Disposition: attachment; filename="wp.csv"');             header('Pragma: no-cache');             header('Expires: 0');              $  file = fopen('php://output', 'w');              fputcsv($  file, array('COLUMN ONE', 'COLUMN TWO'));              foreach ($  arr_post as $  post) {                  $  color = get_post_meta( $  post, 'user-color', true );                 $  size = get_post_meta( $  post, 'user-size', true );                  fputcsv($  file, array($  color, $  size));             }               fclose($  file);          }     } }