Articles of permalinks

Title and post URL based on custom fields?

I have custom fields in my custom post type. They should serve as a title and post slug for URL. Basically, whenever I change the content of the custom fields, the title field should react accordingly. E.g. if the field NAME contains ‘John’ and the SURNAME ‘Smith’, the title should transform to ‘John Smith’. The […]

How to make variables in URL look like the permalink structure?

I’ve been looking for the answer to this everywhere but with no success and that’s why I’m asking here. I don’t even know if the question is the right one. In any case, I’ll try to explain. I have a WordPress page with variables in the URL, like this: http://planeta-beisbol.com/tal-dia-como-hoy/?dia=18&mes=04 The content changes depending on […]

Changing a custom post type “has_archive” after registered

Ok, I’ve seen some similar posts on how to change a custom post type’s attributes after it has been registered (in my case, I’m trying to modify a custom post type created by a plugin without modifying the plugin files). This appears to be working for some properties: function change_wp_object() { $object = get_post_type_object(‘easy-rooms’); $object->show_in_menu […]

Regex in add_rewrite_tag not accepting OR operators?

I am trying to add a custom field to the post permalinks by using a combo of add_rewrite_tag and applying a post_link filter. What I am aiming for is something like this: http://example.com/%category%/%mycustomfield%/%postname% I can manage to get the %mycustomfield% as %psubject% working by using add_action( ‘init’, ‘register_rewrite_tag’); function register_rewrite_tag() { add_rewrite_tag( ‘%psubject%’, ‘(.*)’ ); […]

After updating a page, all pages on the site used the index.php template

I am having a strange problem with a site I am currently building. I will try to give as much detail as possible in the hopes that somebody is able to figure out what is causing this 🙂 Overview of the problem Each time I update a page, all the pages on my site except […]

custom taxonomies on permalink

is it possible to bring custom taxonomies to permalink? currently my permalink is looking something like this /%postname%/%category% but i also want to add custom taxonomies to my permalink so it should look something like this /%postname%/%category%/%location%/%mba_courses% is this possible? the solution to this answer i found, i googled and i found this code, which […]

How to 301 all posts

I am currently using domain/%postname%/ but I am looking to change it to domain/folder/%postname%/ – I unsure how to 301 all posts. If I was to use something like Redirect 301 /$ domain/folder/$ I am thinking this would probably also redirect all pages, archives etc to the same structure, which I do not want. How […]

When is it a good idea to build a permalink structure from scratch?

Is it a good idea to design a permalink structure from scratch? The requirements to the structure are as follows: Pages to be referenced by their structure (example.com/grandparent-slug/parent-slug/child-slug). Posts to be referenced by category and date (example.com/category-slug/2013/07/my-post-slug). Archives only available by category (example.com/category-slug), by category and year (example.com/category-slug/2013) by category, year and month (example.com/category-slug/2013/07) and […]

Subpages return 404 error

I set permanent link as http://site.com/%postname%/. I’m talking about this type of pages: http://codex.wordpress.org/Pages_Screen. All first level pages work fine. But subpages don’t. For the first level page I get url like this: http://site.com/page/. For the second level page – http://site.com/page/subpage/. If I use permanent link http://site.com/?p=123 or http://site.com/2012/02/29/sample-post/, subpage works fine then. How does […]

Custom post types and permalinks

I have a custom post type called Content, that has a capability type of ‘page’ and is set to ‘hierarchical’ => true. I have two pages with the same name “Children”, but they have different parents. What should i be doing differently so that WP doesnt display both of them at the same time no […]