Why is my custom post type not being activated on plug-in activation?

That’s not how register_activation_hook works. register_activation_hook is called only once, when the plugin is activated. CPT’s however need to be registered on every single request, not just when the plugin is activated. This is because WP doesn’t store a list of CPT’s in the database, it’s generated at runtime by PHP code. So instead, register … Read more

Completely disabling password reset/recovery

Since this is a multisite you’ll have to put the disable password filter in a mu-plugin. Create a file in wp-content/mu-plugins with: <?php add_filter( ‘allow_password_reset’, ‘__return_false’ ); That should completely disable password recovery. It will affect all sites, not just that one customer’s: if that’s not what you intended you’ll have to add logic here … Read more

WordPress error: Options page Setting_ not found in the allowed options list

Fixed! function Setting_() { register_setting( ‘Set_my_options’, ‘My_plugin_header_logo’ ); register_setting( ‘Set_my_options’, ‘My_plugin_links_facebook’ ); register_setting( ‘Set_my_options’, ‘My_plugin_links_youtube’ ); register_setting( ‘Set_my_options’, ‘My_plugin_links_email’ ); register_setting( ‘Set_my_options’, ‘My_plugin_links_instagram’ ); } add_action( ‘admin_init’, ‘Setting_’ ); settings_fields( ‘Set_my_options’ );

Update a core option from plugin settings page

The file wp-admin/options.php handles updates to options submitted via the admin area and filters the submitted option values against a list of allowed options for the option page that submitted the request. The allowed list (called a “whitelist” before WordPress 5.5) uses the value of the variable $option_page to determine the settings that are allowed … Read more

How to add custom table style for table block in gutenberg editor

The register_block_style function is what you’ll want. The basic implementation is register_block_style( ‘core/table’, array( ‘name’ => ‘my-table-style’, ‘label’ => ‘My Table Style’, ) ); When you select the style, it will add the is-style-my-table-style class to the block, which you can style using your style.css or other stylesheet. There are two other implementations, where you … Read more

}catch (ex){} showing in header [closed]

You have nested <script> tags in your snippet. Try the following snippet, it’s reformatted for readability: <script id=”mcjs”> try { ! function(c, h, i, m, p) { m = c.createElement(h), p = c.getElementsByTagName(h)[0], m.async = 1, m.src = i, p.parentNode.insertBefore(m, p) }(document, “script”, “https://chimpstatic.com/mcjs-connected/js/users/2095bd42340716fa509260a90/406ca4747992260e47dbadffd.js”); } catch (ex) {} </script>

Is there a way to get plugins and themes not built for multisite to work on a network subsite?

Most plugins and themes don’t need to do anything special to be multisite compatible. Themes especially. So just because a theme or plugin doesn’t say it’s Multisite compatible doesn’t mean it isn’t. Sometimes plugins don’t behave well if you Network Activate them, but the workaround for that is often just to activate them on individual … Read more

How to add CSS via custom plugin?

Here’s your problem: wp_enqueue_style( ‘style’, get_stylesheet_uri() ); wp_enqueue_style( ‘slider’, get_template_directory_uri() . ‘test.css’, array(), ‘1.1’, ‘all’); Neither of those files are in your theme. get_stylesheet_uri refers to the style.css that has the themes name etc, and get_template_directory_uri is the URL of the parent theme. Neither of those are your plugin folder. You can confirm this by … Read more