Which method is best to enqueue scripts

Always use the built-in versions. Don’t waste time with old WordPress installations – other plugins will break there too. See wp-includes/script-loader.php for the list of available files. Quite a lot. 🙂 And avoid remote resources. Some (Google) fail to send the scripts gzip compressed to all supporting browsers, others may not be reliable enough. There … Read more

Redirecting WordPress /.htaccess / HSTS / SSL

So, the canonical URL is https://example.com/…. (You appear to be describing a pointless intermediary redirect? You should only redirect to the final canonical URL, no need for anything in between.) This is just a standard HTTP to HTTPS redirect. You can do this using mod_rewrite at the top of your .htaccess file. For example: RewriteEngine … Read more

Add forward slash on categories url (serve one version of a url)

Filter category_link so WordPress creates slashed URLs for categories, and redirect_canonical so it accepts those URLs: add_filter( ‘category_link’, ‘wpse_71666_trailingslash_cat_url’ ); add_filter( ‘redirect_canonical’, ‘wpse_71666_trailingslash_cat_url’, 20, 2 ); function wpse_71666_trailingslash_cat_url( $url, $request=”” ) { if ( ‘category_link’ === current_filter() ) return rtrim( $url, “https://wordpress.stackexchange.com/” ) . “https://wordpress.stackexchange.com/”; if ( “$url/” === $request and is_category() ) return $request; … Read more

How to prevent redirection to max 2147483647 for larger values of the page query variable?

The Why Part If we have a page called technical and try to load: example.tld/technical/99999999999999999999 then the 99999999999999999999 part is treated as a page query variable with the value of 2147483647. The reason is this rewrite rule for pages: according to the handy Monkeyman Rewrite Analyzer by Jan Fabry. This part of the WP_Query::get_posts(): if … Read more

Multisite – sub-subfolders for certain blogs

In order to do partition your blogs like this you’re going to need to write a custom plugin similar to the WordPress MU Domain Mapping plugin. Here’s how your plugin needs to work. Create a sunrise.php file for your plugin, and properly define(‘SUNRISE’,true); in your wp-config.php file. Create a table which maps the tuples {blog_slug, … Read more

Allow admin login at /admin

another option – redirect /admin/ to wp-login.php with a parse_query action hook: function wpa53048_parse_query( $query ){ if( $query->query_vars[‘pagename’] == ‘admin’ ): wp_redirect( wp_login_url() ); exit; endif; } add_action( ‘parse_query’, ‘wpa53048_parse_query’ ); EDIT Well the above apparently only works with certain permalink structures. Here’s another method hooked to parse_request: function wpa53048_parse_request( $query ){ if( $query->request == … Read more

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