WordPress Rewrite Rules for Custom Post Type and Taxonomy

Hope this can solve your problem function my_custom_post_type() { $labels = array( ‘name’ => _x(‘Projects’, ‘post type general name’), ‘singular_name’ => _x(‘Project’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘project item’), ‘add_new_item’ => __(‘Add New Project’), ‘edit_item’ => __(‘Edit Project’), ‘new_item’ => __(‘New Project’), ‘view_item’ => __(‘View Project’), ‘search_items’ => __(‘Search Projects’), ‘not_found’ => … Read more

Custom rewrite rules for archive page and single post

I found solution! A Monkeyman Rewrite Analyzur plugin was very helpful: https://wordpress.org/plugins/monkeyman-rewrite-analyzer/ So now, I have such working urls… single.php: /magazine-name/issue-year/issue/article-name archive.php: /magazine-name/issue-year/issue /magazine-name/issue-year /magazine-name On a custom post editor page in wp-admin I use Advanced Custom Fields plugin for issue year and issue. You can also define meta fields by yourself. Next I added … Read more

Change author permalink

you need 3 simple functions and hooks first change the author base: //change author/username base to users/userID function change_author_permalinks() { global $wp_rewrite; // Change the value of the author permalink base to whatever you want here $wp_rewrite->author_base=”users”; $wp_rewrite->flush_rules(); } add_action(‘init’,’change_author_permalinks’); then add users to query_vars: add_filter(‘query_vars’, ‘users_query_vars’); function users_query_vars($vars) { // add lid to the … Read more

What is the best permalink structure for SEO?

@nevster, The best permalink structure for seo is /%category%/%postname%/ This permalink structure gives you the most keywords loaded into the URL of your post. Since the category that you’ve placed your post under usually relates to the post title, you will have an extra SEO benefit if other websites use that permalink structure to link … Read more

How do I append multiple taxonomies to the URL?

This is certainly possible by utilizing some rewrite rules of your own to some extent. The WP_Rewrite API exposes functions that allow you to add rewrite rules (or ‘maps’) to convert a request to a query. There are prerequisites to writing good rewrite rules, and the most important one is basic regular expression comprehension. The … Read more

How to get pretty URLs with add_query_arg in permalinks

Just faced the same situation and stumbled upon this question while googling. It seems like this isn’t possible. Core itself just appends strings to the URL if pretty permalinks are enabled, see https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/link-template.php#L571 For anyone interested in this: You can do something like this in your code: if ( ” != get_option(‘permalink_structure’) ) { // … Read more

Best way to flush_rewrite_rules for custom post type, in a mu-plugins plugin?

The flush_rewrite_rules function is reliable in some contexts like a theme or a plugin based on hooks but I’m not sure if it works for a mu-plugin My statement is based on the fact that WordPress is initialized in this way: call the wp-settings.php file call the do_action( ‘muplugins_loaded’ ); hook, here your plugin is … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş