Custom Post type & Taxonomy URL structure

After forever, I figured out an answer! First: we register the custom post type & custom taxonomy: add_action( ‘init’, ‘register_sps_products_post_type’ ); function register_sps_products_post_type() { register_post_type( ‘sps-product’, array( ‘labels’ => array( ‘name’ => ‘Products’, ‘menu_name’ => ‘Product Manager’, ‘singular_name’ => ‘Product’, ‘all_items’ => ‘All Products’ ), ‘public’ => true, ‘publicly_queryable’ => true, ‘show_ui’ => true, ‘show_in_menu’ … Read more

Can’t get a custom template taxonomy page to display

I found this code; function ftc_flush_rewrites() { global $wp_rewrite; $wp_rewrite->flush_rules(); } function ftc_add_rewrites() { global $wp_rewrite; $ftc_new_non_wp_rules = array( ‘find/(this)’ => ‘/addit.php?here=$1’, ); $wp_rewrite->non_wp_rules = $ftc_new_non_wp_rules + $wp_rewrite->non_wp_rules; } add_action(‘generate_rewrite_rules’, ‘ftc_add_rewrites’); add_action(‘admin_init’, ‘ftc_flush_rewrites’); in this thread http://wordpress.org/support/topic/writing-wp_rewrite-gtnon_wp_rules-to-htaccess …not sure if that addresses the problem but good luck!

Must slugs be unique?

In wp_unique_term_slug(): The $slug has to be unique global to every taxonomy, meaning that one taxonomy term can’t have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy. In wp_unique_post_slug(): @param string $post_status no uniqueness checks are made if the post is still draft or pending […] … Read more

Removing leading zeros from custom permalink structure

How about using custom rewrite tags/structure? So we’ll be using these two rewrite/structure tags: %monthnum2% does the same thing as the %monthnum% tag, but without a leading zero; e.g. 3 and not 03 for March. %day2% does the same thing as the %day% tag, but without a leading zero; e.g. 7 and not 07. The … Read more

How to display a public profile page for registered users with custom slug?

Every registered user can have profile, they don’t need to have posts. To change WordPress author’s profile permalink, paste the following code in your functions.php: function change_author_permalink_base() { global $wp_rewrite; $wp_rewrite->author_base = “user”; } add_filter( ‘init’, ‘change_author_permalink_base’ ); After pasting the code, visit Settings->Permalink Structure under your wordpress admin, to flush the rewrite rules. This … Read more

Removing the redirect after changing a page’s slug

This (in your functions.php) will turn it off (but see also the comment I’ve left): remove_action(‘template_redirect’, ‘wp_old_slug_redirect’); It seems odd that your wp_postmeta table wouldn’t have any _wp_old_slug keys – the bit of code that does that is in wp-includes/query.php (wp_old_slug_redirect()) – you could add an exit or debug statement there to check if it’s … Read more

Using $_GET variables in the URL?

Try adding the variable to the WordPress’ array of ‘recognised query variables’… add_filter(‘query_vars’, ‘my_register_query_vars’ ); function my_register_query_vars( $qvars ){ //Add query variable to $qvars array $qvars[] = ‘my_error’; return $qvars; } Then the value of ‘my_error’ can be found via get_query_var(‘my_error’). (See Codex) EDIT From Otto’s comment, it’s better to do: add_action(‘init’,’add_my_error’); function add_my_error() { … Read more

Custom post types – Use post_id in permalink structure

@Bainternet – your answer didn’t fully work but I did some more searching and was able to piece this filter together that did work: add_filter(‘post_type_link’, ‘custom_event_permalink’, 1, 3); function custom_event_permalink($post_link, $id = 0, $leavename) { if ( strpos(‘%event_id%’, $post_link) === ‘FALSE’ ) { return $post_link; } $post = &get_post($id); if ( is_wp_error($post) || $post->post_type != … Read more

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