Override the wp_siteurl and wp_home not work

So dynamically set WP_SITEURL, WP_HOME, i override the wp-config as define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’] ); define(‘WP_HOME’, ‘http://’ . $_SERVER[‘SERVER_NAME’] ); but when i call home_url() it always return x.co.uk hostname home_url() does not make use of any WordPress constants. It uses a call to get_option( ‘home’ ). To use WP_HOME instead, short circuit get_option(): add_filter( … Read more

How to individually set WP_DEBUG on a sub-directory multisite?

You can do this by adding some code to wp-config.php $request_uri = $_SERVER[‘REQUEST_URI’]; $debug_dirs = array (‘/debug-dir1/’,’/debug-dir2/’); // list of directories to turn on debugging foreach ($debug_dirs as $debug_dir) { if (!strncmp($request_uri,$debug_dir,strlen($debug_dir))) { define(‘WP_DEBUG’, true); } } define(‘WP_DEBUG’, false); // debug off by default

WP-Admin not working properly at WordPress multisite with subdirectories

If you installed WordPress Multisite starting with version 3.0 to 3.4.2, you’ve got the correct .htaccess file contents. However, if you started with a newer version (3.5 or higher)—and I’m assuming you did, if you’ve just installed WordPress Multisite recently—your .htaccess file should look like this: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # … Read more

How can I change preview URL?

You can do something like this, add to functions.php add_filter( ‘preview_post_link’, ‘the_preview_fix’ ); function the_preview_fix() { $slug = basename(get_permalink()); return “http://www.mywebsite.com/blog/p/$slug”; } More info HERE and HERE.

Character encoding issue after changing servers

After spending the entire day working on this, I finally found a guide that worked perfectly: https://theblogpress.com/blog/seeing-weird-characters-on-blog-how-to-fix-wordpress-character-encoding-latin1-to-utf8/ Before that, I tried following @Rarst’s information, tried exporting the database and manually cleaning it, tried the UTF-8 Sanitize Plugin with a modified version from here http://www.prelovac.com/vladimir/ultimate-solution-to-weird-utf-character-encoding-problem (which actually worked pretty well, but didn’t fix all the characters. … Read more

How to create custom variables in the wp-config

Why do you need this? In wp-config you can set defines. They will be accesible everywhere without needing to use globals. Define something: define(‘MY_DEFINE_NAME’, ‘THE_VALUE’);. Then in your templates you can show the value like this: echo MY_DEFINE_NAME; Or set the value to a variable: $var = MY_DEFINE_NAME;.

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