Redirect parent taxonomy to it’s child

Assuming state and city are variable path segments, so you are essentially redirecting /investments/<one>/<two>/ to /investments/<two>/ then try the following at the top of your .htaccess file: # Redirect “/investments/<one>/<two>/” to “/investments/<two>/” RewriteRule ^(investments)/[^/]+/([^/]+)/$ /$1/$2/ [R=302,L] If you need any further explanation then just ask in comments. UPDATE: I’ve added an end-of-string anchor ($) to … Read more

How to link to current post in WordPress?

This is exactly the type of scenario shortcodes are intended for. Simply add the following to your theme’s functions file to create the shortcode: add_shortcode( ‘this_permalink’, ‘this_permalink’ ); function this_permalink($atts, $content){ return ‘<a href=”‘. get_the_permalink() .'”>Link to this article</a>’; } .. and use this in your post to render the link: [this_permalink] I cannot think … Read more

Debugging permalink issue

OK fixed it! I had some errant lines in the .htaccess file: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # WP REWRITE LOOP END This was taking precedence over the <IfModule mod_rewrite.c> block – and explains why it was redirecting to the parent directory. (The lesson here is if you are asking … Read more

Adding page links to content that automatically convert to pretty permalinks?

Here is example of simple shortcode that will take ID as argument and echo permalink for it: function link_from_id($atts) { if( isset($atts[‘id’]) ) return get_permalink( (int)$atts[‘id’] ); } add_shortcode(‘link’, ‘link_from_id’); Usage: [link id=1] PS by the way non-pretty permalinks will keep working just fine if you enable pretty mode later and, if I remember right, … Read more

breadcrumbs & rel=”nofollow”

I think it depends what your goal is and what the breadcrumbs represent. I would say that for most wordpress sites nofollow on breadcrumbs is probably a nonissue. Let’s start with nofollow. Nofollow says you don’t want a search engine to pass on page rank to this link. So if you had comment links and … Read more

enable permalinks in window hosting

You’ll need to know which version of IIS running on the server. Old IIS did not have url re-write built-in and require third party module to function. New IIS have them built-in and some cases they also can load your .htaccess file for rules. Make sure you have IIS URL Rewrite installed and enabled.

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