Custom Post Type and Custom REST API Endpoint result in Gutenberg editor not working

I have a custom post type (article) and have implemented a custom REST API endpoint for that post type. I can retrieve single and multiple articles via the custom endpoint without any issues.

However, when I try to add a new or edit an existing article post within WP Admin, I just get a white screen. The web console shows an error that the rest route does not exist but it is using the standard WP REST Route "No route was found matching the URL and request method." The GET call is to /wp-json/wp/v2/article. The route should be /wp-json/kbs/v1/articles – and that route works. When registering the post type I have the following args…

'show_in_rest'          => true, 'rest_base'             => 'articles', 'rest_controller_class' => 'KBS_Articles_API' 

How can I ensure that WP uses the correct route when loading the block editor? Editing with the classic editor works fine.

What type of action is the opposed charisma check in Charm Monster?

Scenario

Standard action, the bard casts Charm Monster. The monster changes posture, it seems to have worked!

"Back up, I charmed it" – he yells to his allies (free action)

while gesturing at the monster to stop fighting (move action or fluff alluding to action for next round?)

Question

What’s the earliest he can make the Opposed Charisma Check to convince (Int 1) monster to back off and stop attacking allies, assuming all his allies immediately went full defense and that there’s no one except for the party and the monster there?

Generic Enum as Type [closed]

Are generic types of enum possible in C#? I’m trying to do something like this:

// in LevelManager.cs script public class LevelManager<T>  where T : struct {     public T something; }  // in enum script (name to be changed accordingly) public enum Level { A,B,C }  // in LevelManager2.cs public class LevelManager2<Level> : LevelManager<Level>{} 

I’m asking this question mainly because the implementation for the generic class LevelManager will be hidden away in an assembly. Hence, I have to rely on something the next person would code the enum Level in. I also get this error in my test script: pic

Alternatively, I could opt for a string based method where the string is the key and I’ll have a Dictionary<string,int>. But that would require a rewriting of my entire script

Any help on how to retain an enum like structure?

Change query based on post type while staying in loop

I have a loop that displays three custom post types.

Thing is, all of these post types use a different logic. ‘elemzesek’ and ‘gyorshirek’ use ACF fields which you can see in the meta_query.

However, the ‘cikkek’ post type, to display the correct articles, would need a

‘tag’ => get_the_title();

The problem is, if this is added, and it runs for ‘elemzesek’ and ‘gyorshirek’ as well, the loops finds no results.

Can someone help me in achieving this?

<?php      $  ceg = get_the_title();     $  ceg_megadasa = get_field('ceg_megadasa');     $  paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $  query = new WP_Query( array(         'post_type' => array('cikkek', 'elemzesek', 'gyorshirek'),         'posts_per_page' => 10,         'paged' => $  paged,         'post_status' => 'publish',         // 'tag' => $  ceg,         'orderby' => 'date',         'order' => 'DESC',         'meta_query' => array(             'relation' => 'OR',             array(                 'key' => 'ceg_megadasa',                 'value' => get_the_ID()             ),             array(                     'key' => 'ceg_megadasa_gyorshirek',                     'value' => get_the_ID()                 ),                      )     ) ); ?> 

Add term of current custom post type to admin body class using admin_body_class

I am trying to add the current custom post type term to the body class of my WordPress admin page. So when I am viewing an existing custom post type that has been assigned a term it will add that term to the body class.

I have found the following code but cannot get it to work for me:

add_filter( 'admin_body_class', 'rw_admin_body_class' ); function rw_admin_body_class( $  classes ) {     if ( 'post' != $  screen->base )         return $  classes;      global $  post;     $  terms = wp_get_post_terms( $  post->ID, 'product_cat', array( 'fields' => 'all' ) );     $  terms = wp_list_pluck( $  terms, 'slug' );     foreach ( $  terms as $  term )     {         $  classes .= ' my_taxonomy-' . $  term;     }      return $  classes; } 

Any pointers on how to get this working?

Default Post post type and custom post type rewrite slugs

So, currently, my blog page is at /blog/ and I also have 2 custom post types. What I’m trying to get is to have all the posts/archives of the Post post type show under /blog/, and for one of the custom post type to use "/" as a rewrite slug. That way, I could get mysite.com/service-foo, mysite.com/bar-service, which are the custom post types, and if I go to post archive for December of 2020, it would show under /blog/2020/12/.

I’ve tried that, as I said, by setting /blog/%postname%/ under my wp admin permalink settings, and using 'rewrite' => array( 'slug' => '/', 'with_front' => false ), with register_post_type for my custom post type. That works for blog posts, but my custom post type posts show 404, with proper url though.

Which 3rd party D&D nested random encounter resource includes combat/social/treasure/mystery encounters for each type of environment?

I had once found a nested random encounter resource, as in there was a master table to determine the whether the party discovered interesting terrain, combat, mysteries, etc and one could then find associated tables for those encounter types for various environments: arctic, trade road, forest, grassland, underwater…

This book was very similar to Necromancer Games 2003 Mother of All Encounter Tables except as I had stated previously unlike MOAET the book I am looking for includes many different types of possible discoveries to come across whereas MOAET simply lists possible monsters one might find and fight in a particular biome.

I do not remember many of the encounters from this book but one that had stuck out in my mind is one from the arctic table where the party comes across a metallic device generating heat in the snow, as if to imply alien or future technology.

Does anyone know the name of this resource or where to find it?

Adding Post id to the end of slug in a Custom Post Type

I have created a Custom Post Type (jobs) – Functions fine. But due to the possibility of duplicate page titles by admin, I need the permalink/slug to include the Post_ID to the end of the Post title, to make it unique, not a new directory but add -id to page title. I have investigated several options. This seems to look the cleanest and simplest addition to my standard post type registration code.

The below code has been added to my Post type registration code, makes the frontend links correct www.domain.com/jobs/postname-postid (www.domain.com/jobs/**accountant**-**123**). However, the rewrite element after, is not working as I get a 404. I’m also concerned about any negative/good practice impact of this on other functions/seo. But it does look quite standard and security safe. Help greatly appreciated.

function mycustomname_links($  post_link, $  post = 0) {     if($  post->post_type === 'listings') {         return home_url('jobs/' .$  post->post_name . '-' .$  post->ID);     }     else{         return $  post_link;     } } add_filter('post_type_link', 'mycustomname_links', 1, 3); 

Rewrite element

function mycustomname_rewrites_init(){     add_rewrite_rule('jobs/([0-9]+)?$  ', 'index.php?post_type=listings&p=$  matches[1]', 'top'); } add_action('init', 'mycustomname_rewrites_init'); 

Full Code

//callback function lt_register_listing_type() {      // Labels array - where labels go.          $  labels = array(          'name' => __( 'Job Listings', LTDOMAIN ),         'singular_name' => __( 'Job Listing', LTDOMAIN ),         'featured_image' => __( 'Recruiter Logo', LTDOMAIN ),         'set_featured_image' => __( 'Set Recruiter Logo', LTDOMAIN ),         'remove_featured_image' => __( 'Remove Recruiter Logo', LTDOMAIN ),         'use_featured_image' => __( 'Use Recruiter Logo', LTDOMAIN ),         'archives' => __( 'Job Archive', LTDOMAIN ),         'add_new' => __( 'Add New Job Listing', LTDOMAIN ),         'add_new_item' => __( 'Add New Job Item', LTDOMAIN ),         'edit_item' => __( 'Edit Job Listing', LTDOMAIN ),     );      // arguments array          $  args = array(          'label' => __( 'Job Listings', LTDOMAIN  ),         'labels' => $  labels,         'menu_icon' => 'dashicons-media-document',         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => true,         'capability_type' => 'post',         // 'rewrite' => array( 'has_front' => true ),         'rewrite' => array( 'slug' => 'jobs'  ),         'capability_type' => 'post',         'has_archive' => true,         'hierarchical' => false,         'supports' => [ 'title', 'editor', 'trackbacks', 'thumbnail', 'excerpt', 'custom-fields', 'comments', 'revisions', 'author', 'page-attributes', 'post-formats' ],         'taxonomies' => [ 'category', 'post_tag' ],         'show_in_rest' => true, );     register_post_type( 'listings', $  args ); } add_action( 'init', 'lt_register_listing_type' );  //Front end link change  function mycustomname_links($  post_link, $  post = 0) {     if($  post->post_type === 'listings') {         return home_url('jobs/' .$  post->post_name . '-' .$  post->ID);     }     else{         return $  post_link;     } } add_filter('post_type_link', 'mycustomname_links', 1, 3);  //Rewrite  function mycustomname_rewrites_init(){     add_rewrite_rule('jobs/([0-9]+)?$  ', 'index.php?post_type=listings&p=$  matches[1]', 'top'); } add_action('init', 'mycustomname_rewrites_init'); 

What type of targets are valid for Scorching Ray?

Almost all the attack spells in the PHB specific the type of target as either a creature, an object, or a point in space (as per Target section on PHB pg 204).

Scorching Ray just says

You create three rays of fire and hurl them at targets within range

But it doesn’t specify what types of targets (creature, object, point in space). Should I interpret that to mean all three are then valid? I couldn’t find anything in the Errata or Sage Advice Compendium on this specifically.