Top level Pages redirecting to homepage!

It turns out that, I was using “year” as a custom taxonomy, which was part of the reserved terms of WordPress!!! With using the reserved term, it will return the 404 error for the top level pages, hence the redirection to the home page. !!! Listed here: https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

How to map a URL to a specific template?

Please place below code in your theme’s functions.php file & let me know how it goes 🙂 add_action(‘wp’, function(){ list($uri, $qs) = explode(‘?’, $_SERVER[‘REQUEST_URI’]); if ( $uri == “/arbitrary/path” ) /* Change this to path that you want to match*/ { locate_template( “template-full-width.php” , true, false ); /* Don’t forget to replace template name with … Read more

Rewrite URL Parameter And Force ‘Pretty’ Permalink

You could force the redirect this way by checking for the get_var query value: add_action(‘init’,’my_redirect_check’); function my_redirect_check() { if (isset($_GET[‘my_var’])) { if ($_GET[‘my_var’] != ”) { if ($_SERVER[“HTTPS”]) {$location = ‘https://’;} else {$location = ‘http://’;} $location .= $_SERVER[‘SERVER_NAME’]; $location .= strtok($_SERVER[‘REQUEST_URI’],’?’); $location = trailingslashit($location); $location .= $_GET[‘my_var’]; $location = trailingslashit($location); wp_redirect($location); exit; } } } … Read more

WordPress Permalinks on Mac OSX Server 5 (El Capitan)

I’d check a few things Apache2 logs open a terminal Check error logs at tail -f /var/log/apache2/error_log Check access logs at tail -f /var/log/apache2/access_log WordPress Check .htaccess has correct rules for basic setup enable wp debugging to see if you can log further errors when the redirect happens this is how you enable WP logging … Read more

.htaccess – Redirect duplicated post ended in ‘-number/’ to the same url without the -number/

You’re close. Add the following to your .htaccess file in between the <IfModule mod_rewrite.c> tags that were created by WordPress: RewriteCond %{HTTP_HOST} RewriteRule ^(.+)-[0-9]+/$ /$1 [R=301] Your .htaccess should looks like the following if it hasn’t been modified by another plugin: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond … Read more

Rewrite URL for results of a custom WP_Query

You could try using the add_rewrite_endpoint function, which would actually let you avoid any htaccess modification (unless you need $_GET). Example: function add_custom_rewrite_ep() { add_rewrite_endpoint(‘cata’, EP_PAGES); add_rewrite_endpoint(‘catb’, EP_PAGES); add_rewrite_endpoint(‘catc’, EP_PAGES); } add_action( ‘init’, ‘add_custom_rewrite_ep’ ); Make sure you flush your rewrite rules. So then, if your URL is /questions/cata/foo/catb/bar/catc/more/, you can access the values with … Read more

Permalinks Messed up

After hours of searching and reading, This is how I solved the Problem. Step 1: Create a .htaccess file in the root folder and put this code there. # BEGIN <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END Step 2: … Read more

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