dbDelta not creating tables

From WordPress-codex about dbDelta: The dbDelta function examines the current table structure, compares it to the desired table structure, and either adds or modifies the table as necessary, so it can be very handy for updates (see wp-admin/upgrade-schema.php for more examples of how to use dbDelta). Note that the dbDelta function is rather picky, however. … Read more

Best way to abort plugin in case of insufficient PHP version?

This function and activation hook prevents the plugin from activating and allows you to check for both a minimum PHP and WordPress version. register_activation_hook( __FILE__, array( ‘Your_Plugin_Class_Name’, ‘activate’ ) ); /** * Plugin Activation hook function to check for Minimum PHP and WordPress versions * @param string $wp Minimum version of WordPress required for this … Read more

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

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