WordPress links and permalink

A customised URL style can not only increase customer satisfaction but also make it easier to identify the location when issues occured.

WordPress links and permalink

Permalink Types

  1. Plain http://example.com/?p=N
  2. Pretty http://example.com/2012/post-name/
  3. Almost Pretty http://example.com/index.php/yyyy/mm/dd/post-name/

Structure Tags

  • %year%
  • %monthnum%
  • %day%
  • %hour%
  • %minute%
  • %second%
  • %post_id%
  • %postname%
  • %category%
  • %author%

check permalink structure

<?php if ( get_option('permalink_structure') ) { echo 'permalinks enabled'; } ?>

Category Base and Tag Base

 example.net/wp/category_base/category_name
 example.net/wp/tag_base/tag_name

Bacis

<!-- Post -->
<a href="/index.php?p=123">Post Title</a>
<!-- Categories -->
<a href="/index.php?cat=7">Category Title</a>
<!-- Pages -->
<a href="/index.php?page_id=42">Page title</a>
<!-- Date-based Archives -->
<a href="/index.php?m=2015">2015</a>
<a href="/index.php?m=201501">Jan 2015</a>
<a href="/index.php?m=20150101">Jan 1, 2015</a>
<!-- Post -->
<a href="/index.php/archives/2005/04/22/my-sample-post/">Post Title</a>
<!-- Categories -->
<a href="/index.php/categories/testing/">Category Title</a>
<!-- Pages -->
<a href="/index.php/a-test-page">Page title</a>
<!-- Date-based Archives -->
<a href="/index.php/archives/2015">2015</a>
<a href="/index.php/archives/2015/01/">Jan 2015</a>
<a href="/index.php/archives/2015/01/01/">Jan 1, 2015</a>

Related Functions

wp_list_pages

<?php wp_list_pages('exclude=4&depth=1&sort_column=menu_order&title_li='); ?>

<?php echo get_permalink(ID); ?>