check if Gutenberg is currently in use

Necessary API Functions/Methods: You’ll need WP_Screen::is_block_editor() method to check if you are currently in the Gutenberg Editor (Since WordPress 5.0). Also, if you install Gutenberg as a separate plugin, then you’ll have the is_gutenberg_page() function available to do the same check. So for an overall solution, you’ll need to combine these two. Of course, this … Read more

Update Option Stored in Multi-Dimensional Array

As far WordPress is concerned – your multi-dimensional array is one option. To update just part of the multi-dimensional array its necessary to retrieve the entire array, alter it accordingly and then update the entire array. Suppose your multi-dimensional array is as follows: my_options = array( ‘option_a’=>’value_a’, ‘option_b’=>’value_b’, ‘inner_array’=>array( ‘foo’ => ‘bar’, ‘hello’ => ‘world’, … Read more

How to include jQuery and JavaScript files correctly?

First rule of thumb: do not deregister core-bundled scripts and replace with other versions, unless you are absolutely certain that no Theme, Plugins, or core itself will break due to the version change. Really, unless you absolutely need an alternate version of a core-bundled script, just use what is bundled with core. Second, I strongly … Read more

What are the common security flaws I need to look for? [closed]

Here is a modified checklist, based on my current (work-in-progress) settings/data security checklist used for reviewing Themes (the principles should be no different for Plugins than they are for Themes): Plugins should prefix all options, custom functions, custom variables, and custom constants with plugin-slug. Plugins should implement Plugin Options and Plugin Settings pages deliberately, rather … Read more

List all sidebar names?

Loop through the global: <select> <?php foreach ( $GLOBALS[‘wp_registered_sidebars’] as $sidebar ) { ?> <option value=”<?php echo ucwords( $sidebar[‘id’] ); ?>”> <?php echo ucwords( $sidebar[‘name’] ); ?> </option> <?php } ?> </select> Note: The ucwords() function is only there to display it exactly as you asked. Not sure if you really want that. How to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)