Enable/Disable WP options programmatically

I understand what you are trying, to make changing the WP config settings more convenient but I do not think it is possible to change them from a plugin. Constants like WP_DEBUG and DISALLOW_FILE_EDIT are defined in core files, specifically in wp-config.php, according to the Codex and, looking over the source code of this file … Read more

Logout redirects to a broken page(home URL is omitted)

Found the answer. It is a bug in WordPress v5.2.3 affecting WordPress in Windows environments. Caused by backslashes in Windows paths that aren’t stripped correctly Details here: https://core.trac.wordpress.org/ticket/47980 I have tried the patch suggested and can confirm it solves the problem. replace: $location = “https://wordpress.stackexchange.com/” . ltrim( $path . “https://wordpress.stackexchange.com/”, “https://wordpress.stackexchange.com/” ) . $location; with … Read more

Best practice differences in DB options and wp-config between live, staging and local WordPress environments?

Seems like a good list you have going… Just a few that come to mind: SCRIPT_DEBUG to false on live and true on staging. WP_CACHE to true on live and false on staging. ping_sites to empty on staging to disable ping services. default_pingback_flag to 0 on staging to not send outgoing pingbacks. Maybe install a … Read more

Performance of several get_option() calls

If you check the implementation of get_option() you’ll see that in line 168 it calls wp_cache_get() like so: $value = wp_cache_get( $option, ‘options’ ); This means multiple calls to get_option(“style_settings”) within the same PHP execution will be served from cache. There is no need to re-invent this, as you might break other functionality with it. … Read more

WordPress plugin options and jQuery

Variable can be passed to jQuery or any javascript using wp_localize_script. Example: add_action( ‘template_redirect’, ‘prefix_enqueue_vars’ ); function prefix_enqueue_vars() { $script_vars = array( ‘setting_1’ => get_option( ‘some_option’ ), ‘setting_2’ => get_option( ‘another_option’ ), ); wp_enqueue_script( ‘my_script’, ‘path/to/script.js’, array( ‘jquery’ ), true); wp_localize_script( ‘my_script’, ‘unique_name’, $script_vars ); } How to get the variables in your javascript: jQuery(document).ready(function($) … Read more

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