What are best practices for configuring a server for WordPress sites?

It’s a very loaded question, I’ll try my best here, keep in mind it’s 4am, so I’m just giving you highlights, not detailed explanations. Linux I’m assuming you’re using a recent version of Ubuntu Change the default SSH port from 22, to something else (/etc/ssh/sshd_config). Either enable AllowGroups or AllowUser in the sshd_config, Install fail2ban … Read more

Override Current Theme Setting in wp_config.php

Drop this in a plugin & activate. I should note this doesn’t take into account things like child themes – it’s purely for toggling which theme renders based on SOME_FLAG. add_filter( ‘stylesheet’, ‘switch_ma_theme’ ); add_filter( ‘template’, ‘switch_ma_theme’ ); function switch_ma_theme() { // Return the theme directory name return SOME_FLAG ? ‘theme-1’ : ‘theme-2’; }

Multisite behind Varnish

I found a fix here: http://core.trac.wordpress.org/ticket/15936 You basically need to modify wp-includes/ms-settings.php like this (remove ‘-‘ lines; add the ‘+’ line): @@ -26,18 +26,8 @@ if ( !isset( $current_site ) || !isset( $current_blog ) ) { + $_SERVER[‘HTTP_HOST’] = preg_replace( ‘|:\d+$|’, ”, $_SERVER[‘HTTP_HOST’] ); $domain = addslashes( $_SERVER[‘HTTP_HOST’] ); – if ( false !== strpos( … Read more

Generate WordPress salt

Does WordPress core has this function defined somewhere? While I haven’t used it, you are probably looking for wp_salt or wp_generate_password. wp_salt is located in wp-includes/pluggable.php. can these salts be generated randomly Yes, of course. are there any specific rules for creating them There is no specific rule. The generic rule is to create long, … Read more

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