How to anchor to embed video

Editing the raw HTML isn’t going to work, a worst case scenario is it fails block validation when reopened in the editor and your edits get replaced automatically. Instead, use the anchor box under the advanced panel. Since the HTML of an embed usually comes from a 3rd party via OEmbed, you can wrap the … Read more

getBlockVariations(…) is undefined in Widget and Template Part editors but not Post Editor

Here’s why did you get an undefined The function itself was defined, but the function call (wp.blocks.getBlockVariations( ‘core/embed’ )) returned an undefined because by the time that you called the function, the block/Gutenberg editor had not yet been initialized. Hence, undefined was returned instead of an array of block variations, because core block types like … Read more

How to use multiple custom post types to archive as front page?

Well, looks like you’ve almost got it. To include multiple custom post types in the WP_Query object, just change: $query->set( ‘post_type’, array( ‘recipes’ ) ); to: $query->set( ‘post_type’, array( ‘recipes’, ‘another-custom-post-type’ ) ); Basically adding more elements to the array. So the final code becomes: function blestrecipes_cpt_filter( $query ) { if ( ! is_admin() && … Read more

What is the best way to relate different custom post types?

I think a better approach for this would be to create a single nested (hierarchical) custom post type. For example, it can be series. Then a single series named sample-series as a top level post of series post type: site.com/series/sample-series/. Then seasons named season-one, season-two etc. can be children of sample-series, like: site.com/series/sample-series/season-one, site.com/series/sample-series/season-two. Similarly, … Read more

Registering custom taxonomy using reserved terms

That’s because some terms are reserved by WordPress core and shouldn’t be used as custom slug. However, WordPress core itself doesn’t check within register_taxonomy function whether a developer has used those reserved terms or not. It’s up to the developers to read the documentation and implement accordingly. These core functions are low level implementations, so … Read more