Clean URL link for page without number

This is because your site already has a post or page (6 in your case) with the slug “photo.” They might be in the trash, or pending as drafts, or whatever … but WordPress automatically appends number to prevent name conflicts. So go through your site, and figure out which other pages are trying to … Read more

Using a portfolio_category slug in wordpress URL

add ‘rewrite’ => array(‘slug’ => ‘portfolio-categories’), but be sure to remove (not sure why that’s there, it tries hides the slug yet tries to rename it to “products” at the same time?): ‘rewrite’ => array( ‘with_front’ => false, ‘slug’ => ‘products’ ), So it looks like this: function mysite_post_types() { register_post_type(‘portfolio’, array( ‘labels’ => array( … Read more

Get closest page ID from URL

You should be able to get the current url from $url = add_query_arg(). Then assuming, the structure: www.example.com/page/subpage/news/ID/post you can use preg_match to extract /page/subpage/news. Then it would be simple matter of using get_page_by_path();. If that fails you can then check /page/subpage/ and finally /page.

Site URL always in front of other URLs

You need to start your links with http:// Examples: The link facebook.com/mypage becomes http://facebook.com/mypage The link www.commentorsite.com/ becomes http://www.commentorsite.com/ This will stop the links becoming http://mysite.com/www.commentorsite.com/ or http://mysite.com/facebook.com/mypage

Confusion about how a URL is being parsed

WordPress uses set of regular expressions to parse urls (so called rewrite rules). It matches them in some order and stops when first matching rule is found. It’s a little bit hard to say what rule is matched in your case. We don’t know what are your permalink settings and what other changes to rewrite … Read more

How to create a page for authors? like www.myblog.com/author/

A bit like a team/contributors page. You could look at the contributors page template included in the Twenty Fourteen default theme for WordPress as an excellent example. May be a challenge to use it with another theme depending on your skill level. Another option which i have coded myself for Genesis, is a widgetized page … Read more

Get canonical link

Since WP 4.6 there has been a core function for this: wp_get_canonical_url() Call it with a post ID to get that post’s canonical URL, or in the loop without a post ID to get the current post’s canonical URL.

Remove number in URL

When you delete a post, it merely gets put into the “trash” and retains its slug. When you created the “new” contact page, the slug “contact” was already in use by the original contact post that is in the trash. Go into your posts on the dashboard and click on the “Trash” link near the … Read more