Restricting a Plugin to Only Load its CSS and JS on Selected Pages?

Styles and scripts are always set up by the functions wp_enqueue_script() and wp_enqueue_style(), which have to be tied to a particular action hook in order to function. I took a peek inside Contact Form 7, and it looks like it’s using action tags of wpcf7_enqueue_scripts and wpcf7_enqueue_styles to add them to the wp_print_scripts and wp_print_styles … Read more

How can I debug the TTFB in WP?

Meanwhile, I found some plugins and tools that can help with this: Query Monitor Laps Debug Bar with some add-ons(Slow Actions, Rewrite Rules, etc.) If you really wanna go deep, try using Webgrind. Not the most friendly tool, but it’ll do the job. Be aware that some of this tools will also have an impact … Read more

What is the best caching option for WordPress multi-site on non-shared hosting?

Basic answer to “what plugin” would probably be W3 Total Cache. It is one of the most functional and actively developed plugins at moment. However complete performance chain is much longer that WordPress plugin alone can handle. Web server (Apache or something else) configuration (response time, time to first byte, headers). Database (time spent processing … Read more

Performance of my permalink structure?

You can check by looking at the size of the rewrite_rules option in the database. If it’s small (which I believe it should with this structure), you’re not using verbose rules. By contrast, if you see several lines per static page, you’re using verbose rules and it’s not good.

Slow Query for the wp_options table

Update: The reason the query is being logged is it doesn’t use an index. The query time is 0, i.e. it actually executes fast. You can unset the “log-queries-not-using-indexes” option if you don’t want these to be logged. The wp_options table has no index on autoload (it now should, it was added to WP core … Read more

get_option() vs get_theme_mod(): Why is one slower?

The answer that yes, the theme_mod functions will be slower, but not significantly, and the benefits outweigh the differences. Theme mods are stored as options. So, in essence, the theme_mod functions are wrappers around the options functions. First, understand that theme_mod settings are stored as an array in a single option, keyed to the specific … Read more

Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?

late answer From a brief look: You’d have to use include( admin_url().’load-scripts.php’ ); and include( admin_url().’script-loader.php’ ); Then jump into $GLOBALS[‘wp_scripts’]: Use… $wp_scripts->default_dirs( array_merge( $wp_scripts->default_dirs ,array( ‘/themes/your_theme/js/’ ) ); …to extend it. And then use $wp_scripts->add( $handle, $path_from_content_dir, false/array( $deps ), $ver ) to add a script. Notes: Uncompressed scripts get searched by .dev.js (when … Read more

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