Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

thunderbug on "use taxonomy slug in custom posttype permalink"

$
0
0

Hi there,

I really need you help. :(

I registered a custom post type called "guidepage" and a custom taxonomy called "guide-type" for this post type.

No I want the permalink of guidepage to be like "/guides/%taxonomy-slug%/%postname%

Here is my current code but the permalink still looks like this: http://d.pr/i/EPp4

add_action('init', 'zug_initStuff' );
function zug_initStuff() {
	zug_createGuideTaxonomy();
	zug_createGuidePostType();
}

function zug_createGuidePostType() {
  $labels = array(
    'name' => 'Guide Pages',
    'singular_name' => 'Guide Page',
    'add_new' => 'Add New Guide Page',
    'add_new_item' => 'Add New Guide Page',
    'edit_item' => 'Edit Guide Page',
    'new_item' => 'New Guide Page',
    'all_items' => 'All Guide Pages',
    'view_item' => 'View Guide Page',
    'search_items' => 'Search Guide Pages',
    'not_found' =>  'No guide pages found',
    'not_found_in_trash' => 'No guide pages found in Trash',
    'parent_item_colon' => '',
    'menu_name' => 'Guides'
  );

  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
	'_builtin' => false,
    'show_in_menu' => true,
    'menu_position' => 25,
    'query_var' => true,
    'rewrite' => array(
						'slug' => 'guides/%guidetype%',
						'with_front' => false,
						'hierarchical' => true
					),
    'capability_type' => 'page',
    'has_archive' => true,
    'hierarchical' => false
  ); 

  register_post_type( 'guidepage', $args );
  global $wp_rewrite;
	$wp_rewrite->flush_rules();
}

The following lines are just for testing. I'll remove them later /put them in the activation hook.

global $wp_rewrite;
$wp_rewrite->flush_rules();

Thanks for your help!


Viewing all articles
Browse latest Browse all 8245

Trending Articles