How to rewrite custom post type with custom taxonomy urls?

When you are adding a custom taxonomy you are able to declare a rewrite slug – $labels = array( ‘name’ => _x(‘Name’, ‘taxonomy general name’), ‘singular_name’ => _x(‘Singular Name’, ‘taxonomy singular name’), ‘search_items’ => __(‘Search Items’), ‘all_items’ => __(‘All Names’), ‘parent_item’ => __(‘Parent Item’), ‘parent_item_colon’ => __( ‘Parent Ites:’), ‘edit_item’ => __(‘Edit Item’), ‘update_item’ => … Read more

Rewriting URLs in WordPress

‘event/industry/(.+)/?$’ The above is the URL that will be rewritten behind the scenes. The brackets create what is known as a “backreference”. ‘index.php?post_type=eg_event&industry=’ . $wp_rewrite->preg_index(1) The above is the actual URL that will be served to the browser. So, http://yourdomain.com/event/industry/abc/ matches the rule “event/industry/(.+)/?$”. The term ‘abc’ becomes a backreference with index 1, because it … Read more

Pagination problem

The function redirect_canonical() is ‘responsible’ for your problem. Your default WordPress pagination (with core functions) is not gonna work if you do this, but you can filter out the pagination for your particular custom url: add_filter( ‘redirect_canonical’, ‘wp230913_canonical’, 10, 2 ); function wp230913_canonical( $redirect_url, $requested_url ) { if ( preg_match( “#foo/bar/[0-9]+/page/[0-9]+#”, $redirect_url ) ) { … Read more

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