How can I remove the H1 option from the gutenberg editor

Gutenberg doesn’t give an option to remove specific heading levels from the editor interface. But, I think you can workaround using a bit of custom code (both PHP and some JavaScript). If you’re interested, try this. Add this custom snippet to your theme’s function.php file. function remove_h1_from_editor() { wp_enqueue_script( ‘remove-h1’, get_template_directory_uri() . ‘/js/remove-h1.js’, array(‘wp-blocks’, ‘wp-dom-ready’, … Read more

query loop “inherit query from template” prevents setting sort order

Given your detailed description, it seems you’ve taken several steps to address the issue of sorting your archive pages in WordPress. The fact that changing the “order”:”desc” to “asc” in the archives.html file of your theme didn’t yield the desired result suggests a deeper issue. Try this in your functions.php file: function wpb_modify_category_query( $query ) … Read more

Attributes array not saving values

The best way to achieve what i was wanting to do was to use the core blocks for latest post. Then style as I needed to. Here is what my code looks like. import { registerBlockType } from “@wordpress/blocks”; import { __ } from “@wordpress/i18n”; import { useBlockProps, InnerBlocks, } from “@wordpress/block-editor”; registerBlockType(‘sfs-test-header-para-block/sfs-test-header-para-container-block’, { title: … Read more

Preset category checkbox from URL parameter when creating new post

you can do that on php side with this hook : // the 2nd “post” of the hook is the post type add_action(“save_post_post”, function ($post_id, $post, $update) { if ($update) { // a post is updated return; } if (!isset($_GET[“preset_category”])) { return; } $term = get_term($_GET[“preset_category”]); if (isset($term)) { wp_add_object_terms( $post_id , $term->term_id , $term->taxonomy … Read more