How do I serve static content on same domain as WordPress

If the files are static HTML, then you only need to be concerned with name collisions for the directory structure. And if you don’t have anything in WordPress that generates /demo/subfolder/ you don’t have to worry about ignoring it – it’s already ignored. I have a sandbox folder that I use for a similar purpose … Read more

Multisite in subfolder – How to make new sites to be in same level subfolders as the main site

After these years I hope this will still answer your question… I think I’ve got the situation working you want. Allthough I don’t have the WordPress installation in ‘/subfolder/’, but I’ve a installation ‘in subdirectory’ per language, and on the same level: my-domain.com/nl/ -> this is primary installation, site id = 1 my-domain.com/en/ -> this … Read more

What is the best way to get directory path for wp-config.php?

I came up with this solution. This function checks in each directory level starting from the directory of the current file for the file wp-config.php. <?php function find_wp_config_path() { $dir = dirname(__FILE__); do { if( file_exists($dir.”/wp-config.php”) ) { return $dir; } } while( $dir = realpath(“$dir/..”) ); return null; } ?> To actually include the … Read more

Categorising themes by folders in backend

Updated plugin version available at GitHub. I first saw your Question at [wp-hackers] list, and, after implementing the solution, was about to publish a Q&A for that. Well, it’s already here, and has a bounty put on it 🙂 As Daniel Bachhuber points out in the thread: WordPress.com puts themes inside of subdirectories /wp-content/themes/public /wp-content/themes/premium … Read more

Rename UPLOADS folder with custom WP_CONTENT_DIR

After digging around, I ended up with using upload_dir filter. Here is what I tried in functions.php to change uploads to media. Hope it can help someone too 🙂 add_filter(‘upload_dir’, function($uploads) { $custom = []; foreach ($uploads as $key => $value) { if ( false !== strpos($value, ‘/app/uploads’) ) { $custom[$key] = str_replace(‘/app/uploads’, ‘/app/media’, $value); … Read more

Dash or underscore in theme folder name?

In short, there is no well defined convention for naming a theme’s directory, and all of the following are valid (among others): my_wordpress_theme my-wordpress-theme (empirically the most popular option within the ecosystem) MyWordPressTheme mywordpresstheme (what the default themes use) Details The WordPress PHP Coding Standards Handbook states that filenames should be all lowercase and hyphen-separated. … Read more

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