How can I get WordPress CPT archives and page templates to work with prettified permalink settings?

I’d try two things first: Make sure you have flushed the permalinks ( Settings – Permalinks – Update ) Make sure you are using an init action hook to create your custom post types (I’ve forgotten to do this before and had the type of issue you describe) If that fails, I’d recommend updating your … Read more

How do you intercept the page requests in WordPress?

template_include Your first option here is to change the template that is used your pages so that you can do anything you wish, once that template has been called. The example below checks that the page is called ‘portfolio’, but obviously you can insert your own checks, and then locates a template called ‘my-template-page.php’. If … Read more

Make custom user_meta as permalink for post

After searching a lot i finally came up with this solution. My custom post type is “facility” and the custom_user_meta=”organization_name“. First go to http://localhost/wp-admin/options-permalink.php and choose custom structure – in the text box put /%organization_name%/%postname%/ After that put the below given code in functions.php add_action(‘init’, ‘tdd_add_rewrite_rules2’); function tdd_add_rewrite_rules2(){ // Register custom rewrite rules global $wp_rewrite; … Read more

Change the permalinks structure

When you save permalink settings, is there the following notification at the bottom of page? If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all. I’m … Read more