Archive page with multiple taxonomies rewrite

ok, so I thought I’d come back and answer my own question in case its useful to someone else. To start, the CPT: ‘query_var’ => true, ‘has_archive’ => false, ‘rewrite’ => array( ‘slug’ => ‘resources’, ‘with_front’ => false ), Tax1: ‘query_vars’ => true, ‘rewrite’ => array( ‘slug’ => ‘resources/type’, ‘with_front’ => false ) Tax2: ‘query_vars’ … Read more

add_rewrite_rule not loading correct page nor getting variables

This seems to work! ?post_type=directors&name=$matches[1] seems to be the key add_rewrite_rule( ‘directors/([^/]*)/showreels/([^/]*)/video/([^/]*)/?’, ‘index.php?post_type=directors&name=$matches[1]&showreel=$matches[2]&video=$matches[3]’, ‘top’ ); so final code now; function wpse13483_init() { add_rewrite_rule( ‘directors/([^/]*)/showreels/([^/]*)/video/([^/]*)/?’, ‘index.php?post_type=directors&name=$matches[1]&showreel=$matches[2]&video=$matches[3]’, ‘top’ ); } add_action( ‘init’, ‘wpse13483_init’ ); function wpa52794_query_vars( $vars) { $vars[] = ‘video’; $vars[] = ‘showreel’; return $vars; } add_filter( ‘query_vars’, ‘wpa52794_query_vars’ );

Adding meta values to permalink

Was able to get this working. Thought I would write down what we did in the hopes that it will help someone in the future (or someone can give me feedback on how to better improve it!) Registered Custom Rewrite Rules add_action(‘init’, ‘pub_rewrite_rules’); function pub_rewrite_rules() { global $wp_rewrite; $wp_rewrite->add_rewrite_tag( ‘%pubyear%’, ‘([0-9]{4})’, ‘pubyear=”); $wp_rewrite->add_rewrite_tag( “%pubmonth%’, ‘([0-9]{2})’, … Read more

How to modify URL structures in custom post types and taxonomies or terms

I’m not sure it’s possible, or perhaps it just may not be the best approach. Here is my reasoning: domain.com/post-type-name/taxonomy-name/term-name/post-title/ Posts can be attached to multiple terms, so in essence there could be multiple links to the same post: domain.com/post-type-name/taxonomy-name/term-name/post-title/ domain.com/post-type-name/taxonomy-name/term2-name/post-title/ domain.com/post-type-name/taxonomy2-name/term3-name/post-title/ domain.com/post-type-name/post-title/ Depending on how you got there. You will definitely be able to … Read more

How Do I add a redirect rule to WordPress?

adding these functions should do the trick. First things first, add this line to functions.php while you are working on this: add_action(‘init’, ‘flush_rewrite_rules’); What that code will do is constantly flush the rewrite rules, it makes this easier to test while you are working on it, instead of having to go in and manually reset … Read more

Custom post types and custom variables — add_rewrite_tag() question

function add_places_rewrite_tags() { add_rewrite_tag(‘%action%’,'([^&]+)’); } add_action( ‘init’, ‘add_places_rewrite_tags’ ); First add the rewrite tag action (action=xxxx) function add_places_rewrite_rules() { add_rewrite_rule(‘^area/([^/]*)/places/?’,’index.php?post_type=area&name=$matches[1]&action=places’,’top’); add_rewrite_rule(‘^area/([^/]*)/([^/]*)/places/?’,’index.php?post_type=area&name=$matches[2]&action=places’,’top’); } add_action( ‘init’, ‘add_places_rewrite_rules’ ); Then add a custom rewrite rule. (post_type=area may be different if you made a custom slug for the posttype, use the posttype name). Remember to flush your rewrite rules … Read more

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