How to increase the character limit for post name of 200?

It happens because when you save a post, WordPress calls sanitize_title function to sanitize your title. This function applies sanitize_title filter. One of core hooks for sanitize_title filter is sanitize_title_with_dashes function, which checks title on utf8 format by calling seems_utf8 function and if the title has utf8 format, the function call utf8_uri_encode function. utf8_uri_encode function … Read more

Nice RSS Feed URLs for each custom post type

If you set ‘has_archive’ => TRUE in register_post_type() the post type will have its own feed on /books/feed/ and its items are not included in the main feed. Example plugin <?php /* Plugin Name: WPSE13006 feed for CPT demo */ ! defined( ‘ABSPATH’ ) and exit; add_action( ‘init’, ‘wpse13006_register’ ); // Call wp-admin/options-permalink.php once after … Read more

Turn off %postname% auto-incrementing?

Hi @Thompson: Unfortunately the post name must be unique for a given post type, and hierarchy level if the post type is hierarchical. There are a couple ways to address this: Use /%post_id%-%postname%/ instead of /%post_id%/%postname%/; that makes it unique and thus won’t append any annoying -Ns to the end of your URLs and will … Read more

Custom rewrite rules for a $_GET request

First add get to query vars array: function add_query_vars_wpa12572($vars) { $vars[] = ‘get’ return $vars; } add_filter(‘query_vars’, ‘add_query_vars_wp12572’); then add the rewrite rule function author_rewrite_rules_wpa12572( $wp_rewrite ) { $newrules = array(); $new_rules[‘get_(\d*)$’] = ‘index.php?get=$matches[1]’; $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_filter(‘generate_rewrite_rules’,’author_rewrite_rules_wpa12572′);

custom taxonomies on permalink

What you’re looking for is a 301 redirect. I use two plugins to catch do this. One notify’s me of 404 errors ( http://wordpress.org/extend/plugins/404-notifier/ ) and the other makes writing the 301 redirects easy ( http://wordpress.org/extend/plugins/simple-301-redirects/ ). You could also write the 301 redirects in your .htaccess file and dig through the server logs to … Read more

Permalinks for WooCommerce Categories and Subcategories

I was able to resolve this with the following code which generates rewrite_rules for each subcategory, which is preferred during matching since it’s more specific: function wpse_291143_generate_taxonomy_rewrite_rules( $wp_rewrite ) { global $wp_rewrite; $base = “shop”; $rules = array(); $terms = get_terms( array( ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => false )); foreach($terms as $term) { $term_children = … Read more

add_rewrite_rule with 3 or fewer matches?

Well, apparently lots of trial and error pays off! I used this code instead, where I reversed my add_rewrite_rules and now it works perfectly. // Remember to flush the rules once manually after you added this code! add_rewrite_rule( // The regex to match the incoming URL ‘our-work/our-year/([^/]*)/([^/]*)/([^/]*)/?’, // The resulting internal URL: `index.php` because we … Read more