Change default template in the block editor (Gutenberg)

I want to change the default template for my pages to a template called fullwidthpage.php.

I have seen this question posted and answered for pre-Gutenberg WordPress, but I have not found a working answer for Gutenberg WordPress (version 5.3.2 at the time of this question).

This is the non-working answer I found. When I try the non-working answer the template is set to fullwidthpage.php but when I try to update the page I get a message that says “Updating failed.”

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'); 

Modifying default magnification of Documentation

Well, finally, after decades of Mathematica rendering notebooks incorrectly in Windows, and after many years of Mathematica not supporting high-resolution displays in Windows, finally version 12.1 fixes these problems. Well, almost

Here’s the fly in the ointment: Now the fonts chosen in the documentation are too big: They’re using 14-point fonts for default text, which is ridiculously large. This is probably because in the bad old days, before 12.1, Mathematica would render fonts too small (by a factor of 72/96), so the good folks at Wolfram simply upped the font size to make the documentation readable. Which means that now, with fonts suddenly rendered correctly, that size is too large. So, how to fix this?

The easiest solution I can see (short of waiting another 25 years for Wolfram to get those damn font sizes right…) would be to have Mathematica render all of the documentation at a magnification of 0.75, say. So here is my question:

Is it possible to force Mathematica to display all of the notebooks for its documentation at a 0.75 magnification? I figured out that those notebooks use the style sheet “Reference.nb” which I could edit, in principle (after copying it into my user folder hierarchy). I’m just not sure if it is possible to define the magnification of a notebook as a whole in its style sheet, and if so how to do it. I could of course change the magnification for each of the various kinds of cells that are described in Reference.nb, but that’s a ton of work, and who knows what I might break by doing so.

Can this be done?

How to register meta field with checkbox to REST API with default value true?

I have a meta field with checkbox, it has by default checked value, but when I register it to REST API my checkbox become unchecked.

How can I get it checked by default?

Here is my code for metabox:

function modest_gutenberg_meta_add_meta_box() {     $  post_types = array('post', 'page', 'modest_portfolio');     foreach ($  post_types as $  post_type) {         add_meta_box(              'modest_gutenberg_meta_post_title_option',              esc_html__( 'Title Options', 'modest-gutenberg-meta' ),              'modest_gutenberg_meta_post_title_settings',              $  post_type,              'normal',              'high',              array('__back_compat_meta_box' => true));     } }  add_action( 'add_meta_boxes', 'modest_gutenberg_meta_add_meta_box' );  function modest_gutenberg_meta_post_title_settings($  post) {     $  visibility_title = get_post_meta($  post->ID, '_modest_gutenberg_meta_post_title_visibility', true);     $  checked_title = 'checked';     if($  visibility_title == 'unchecked' && !empty($  visibility_title)) {            $  checked_title = '';     }      wp_nonce_field( 'modest_gutenberg_meta_update_post_title_settings', 'modest_gutenberg_meta_update_post_title_nonce' );     ?>          <input type="checkbox" name="modest_gutenberg_meta_post_title_visibility_field" id="modest_gutenberg_meta_post_title_visibility_field" value="1" <?php echo $  checked_title; ?> />             <label for="modest_gutenberg_meta_post_title_visibility_field"><?php esc_html_e( 'Display Title', 'modest-gutenberg-meta' ); ?></label>      <?php }  function modest_gutenberg_meta_save_post_title_settings($  post_id, $  post) {      $  edit_cap = get_post_type_object( $  post->post_type )->cap->edit_post;     if( !current_user_can( $  edit_cap, $  post_id )) {         return;     }     if( !isset( $  _POST['modest_gutenberg_meta_update_post_title_nonce']) || !wp_verify_nonce( $  _POST['modest_gutenberg_meta_update_post_title_nonce'], 'modest_gutenberg_meta_update_post_title_settings' )) {         return;     }     if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return;     }      if(array_key_exists('modest_gutenberg_meta_post_title_visibility_field', $  _POST)) {         update_post_meta(              $  post_id,              '_modest_gutenberg_meta_post_title_visibility',              sanitize_text_field($  _POST['modest_gutenberg_meta_post_title_visibility_field'])         );     } else {         update_post_meta(              $  post_id,              '_modest_gutenberg_meta_post_title_visibility', 'unchecked');     } } 

And then I register_meta:

function modest_gutenberg_meta_register_meta() {     //title     register_meta( 'post', '_modest_gutenberg_meta_post_title_visibility', array(         'show_in_rest' => true,         'type' => 'boolean',         'single' => true,         'sanitize_callback' => 'sanitize_text_field',         'auth_callback' => function() {             return current_user_can( 'edit_posts' );         }     ) ); }  add_action('init', 'modest_gutenberg_meta_register_meta'); 

I’m registering meta for Gutenberg Plugin to add a new Sidebar, there I have ToggleControl, which make my meta update and it’s working.

But I can’t understand what am I doing wrong with default value?

How can I get my value checked by default inside WordPress REST API?

If I delete register_meta() function and switch inside add_meta_box() __back_compat_meta_box to false and refresh the page which I’m editing,

I will get my checkbox true and then if I register_meta() again and refresh page I will get my meta in REST API checked.

Sorry for my English, hope someone can help me)

Thanks in advance.

Is there a way to make the default image sizes refer to the full-sized file?

I’m offloading all media files to S3 and serving them through Imgix, who perform all compression/resizing on the fly. To prevent WP from producing extra files, I’ve removed the default image sizes completely using filters:

// Prevent any image sizes from being created at the time of upload/regeneration. add_filter( 'intermediate_image_sizes', '__return_empty_array', PHP_INT_MAX ); add_filter( 'intermediate_image_sizes_advanced', '__return_empty_array', PHP_INT_MAX ); 

However, what I’d really like is for the sizes to exist but remain pointed to the full-sized file, with a query string that tells Imgix to resize it, eg https://media.domain.com/path/to/image.jpg?w=800 for an 800px image, preferably taking the value from what’s been entered on the Media settings screen.

Is this possible?

Changing the default forward policy to accept (VPN/NAT)

I came across something that seems counter-intuitive while reading a tutorial associated with a very popular hosting provider showing people how to install their own Debian-based OpenVPN server. Specifically the default forward policy is changed from “DROP” to “ACCEPT” in order to allow traffic to be routed correctly. There seem to be no additional rules anywhere that would in any way restrict routing beyond this default policy.

If I understand correctly this could allow someone to use the machine as a gateway into the VPN, potentially allowing unsolicited traffic through. The logic here is that without any rules preventing packet forwarding the OS will simply forward any traffic not destined for itself. For example someone could make a static route for the external IP assuming a network of 10.8.0.0/24. Normally NAT would act as a firewall but in this case I can only assume it would, at best, rewrite the IP of response packets.

This is the tutorial for reference: How To Set Up an OpenVPN Server on Debian 9

I just want to know are my concerns justified or is there something that I’m missing?

how to set default update_user_meta values wordpress

so i installed a theme which gives a default value to a meta

the code the theme uses is

      update_user_meta($  uid, '_sb_pkg_type', 'free'); 

i would like to add this code to wordpress core so whenever a user registers it sets a default value of ‘free’ to _sb_pkg_type instead of nothing..

meaning i would like to know how can i set a default user meta to _sb_pkg_type in WordPress core

sorry if this question is not understood as my English is not my first languge.