Articles of directory

How to replace a wordpress installation in root directory with another in a subdirectory?

Someone with a wordpress site in lets say www.thess.com asked me to change the theme, so i thought it would be safer to first create a second wordpress installation in lets say www.thess.com/welcome and then, after having moved all of the content to the new installation and calibrated the theme, move the new installation to […]

WordPress root directory change + Theme directory change

I’d like to create the following structure for my WP installation: htdocs (base dir) wp (WordPress dir) themes (WordPress theme dir) plugins (WordPress plugin dir) upload index.php .htaccess So far I’ve been able to change the WordPress root directory [1] (which means that even though we’re on «wp», we don’t see the http://example.com/wp url, but […]

Let users edit their role from the frontend

Most site ask users to choose their role at registration (for example it can be “are you an athlete/student/worker/designer” and each of these would be a user role which would appear in a different directory) but I’d like to let them choose after registration. How can I do this ? Is their a way to […]

How do I include a partial from a directory below a wordpress theme directory?

I have 3 themes set up right now and I need them all to inherit partials from the same source in order to update all three themes at the exact same time when I change any of those partials. I’m seeing that include/require (../../../includes/vital/partial.php); doesn’t work from within single.php or any other other theme template […]

get_template_directory() returns wrong address on VPS

I’m having the following problem with a WordPress installation on a VPS server. I’m trying to read from a JSON file but the returned address from get_template_directory() is wrong: $url = get_template_directory() . ‘/inc/includes/acf-fonticonpicker’; $json_file = trailingslashit($url) . ‘icons/selection.json’; if($wp_filesystem->exists($json_file)){ $json_content = $wp_filesystem->get_contents($json_file); } $json_file is empty because the JSON file is not found. The […]

How to visit php file in my custom directory under site root directory

I hope to create a directory wp-mybiz as same level as wp-content, wp-admin, and wp-includes under site root directory to collect my business logic codes. But if I try to visit php using url http://example.com/site/wp-mybiz/mycode.php, it get raw php file rather than html file generated by this php. Any wrong to configure apache, wordpress, or […]

Wp-CLI not working with WordPress installed with composer

I’ve installed a version of WordPress using composer, and modified the default folders for the content (/wp-content) and the core (/wp). My wp-config.php gets its DB_NAME, DB_USERNAME, DB_PASSWORD from environment variables defined in the .htaccess file. I am able to connect to my wordpress instance using my browser, so the connection information in there is […]

WordPress page not taking precedence over server directory

On my wordpress site, I have a page mysite.com/download. On the same server I have a directory named download, where I store files which I need to provide on download page. So the problem is that when someone tries to access mysite.com/download, he’s taken to the directory instead of the page. I have turned off […]

Move WordPress from Root to Subfolder

The standard problem of moving the WP installation from the root into the my_subdir folder keeping the url www.example.com. Regarding the article Moving a Root install to its own directory, Method I (Without URL change) After Installing the wordpress in root folder, move EVERYTHING from root folder into subdirectory Create a .htaccess file in root […]

google xml sitemap won't work on directory install

I have installed wordpress in directory above the root called “wp”. I’m having issues with the google xml sitemap generator. I cannot rebuild the xml code and write it the sitemap.xml file. I have been on the phone with my hosting company and they assure me the file does have full control for its file […]