Ignore postname in permalink

Being in wp-admin/options-permalink.php (Permalinks) you can easily set this using Custom Structure: /%post_id%/%postname%/ So you can browse the Hello World post with: http://example.com/1/hello-world/ But if you strip out the postname from the URL like below: http://example.com/1/ You can still access the Hello World post. CAUTION Changing permalink in any live site may cause bad effect … Read more

Overwrite WordPress’s URL rewrite not working

WordPress has its own rewriting system in PHP so you can do it both ways If you want to rewrite these url from htaccess, i would only make it rewrite http://www.example.com/newsletter/confirm/token to http://www.example.com/newsletter/?ut=token instead of trying to rewrite http://www.example.com/newsletter/confirm/token to http://www.example.com/index.php?page_id=4058&ut=token And let WordPress handle the page id rewrite. So the htaccess rule would be: … Read more

How to rewrite a page url

You can change page URL from the page editor. If you want to make changes for all the pages. You can go to settings -> general settings -> permalink and change it to your desired value. To change for a single page, modify your .htaccess : <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f … Read more

get_template_directory() returns wrong address on VPS

You can read data on your server with file_get_contents(). If you want to make sure the file exists and is readable then use is_readable(). You don’t really need to use trailingslashit() in this case because you’re constructing the URI yourself. // path to file under current theme $json_file = get_template_directory() . ‘/inc/includes/acf-fonticonpicker/icons/selection.json’; // make sure … Read more

Multiple wordpress installations on same server

Your .htaccess file needs to be updated as follows (change the obvious parts for site3): # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /site2/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /site2/index.php [L] </IfModule> # END WordPress I was having similar issues and saw that whenever I would log in … Read more