I have a structure like this for my custom post types: domain.com/member/member-name/book/book-name Basically, I have a custom post type of member, and the member-name is the post. What I want to do is pass a variable called books, but I can't get my code to work. I've based my solution on one that has previously been asked on here but my structure is different, and I've googled and googled to no avail. I really cant get my head around rewrite …
I've been having looot of troubles with this function, I don't know what to do, because I tried everything. I have a custom post type, let's call it study. The url structure for it is http://example.com/study/studyname They have different sections, I want to have the new structure like this: http://example.com.com/study/studyname/view/view_arg So far I've tried add_rewrite_endpoint() and add_rewrite_rule() functions, with any result. I also tried to disable all my plugins just in case one of them may be the reason, but …
I have set a custom rewrite rule. The url gets parsed and loads the correct page. When the same page is added in the menu editor, it does not generates the different path. I want that my same rewrite rule should be used to create the post url. If there is a function/hook/filter which is called with the post object, then my callback will prepare the correct URL. But I cannot get hook like the_permalink to work in that way …
I have a parent/child and another parent/child/child pages. I have 2 separate page templates for both pages and the following add_rewrite_rule() code in place: add_rewrite_rule( '^user/dashboard/([^/]*)/?’, 'index.php?pagename=user/dashboard&profile=$matches[1]', 'top' ); add_rewrite_rule( '^user/dashboard/billing/([^/]*)/?’, 'index.php?pagename='user/dashboard/billing&profile=$matches[1]', 'top' ); The first one (i.e. parent/child) works fine but the 2nd one (i.e parent/child/child) is not working. Meaning when I go to the parent/child/child page, it is using the template of the parent/child page and not the one assigned to itself. If I comment out the first …
I have a url example.com/sample-page/?amount=567 It initially worked ok, it redirects to: example.com/sample-page/567 But after few days, i noticed its not working any more. Its now redirecting to post without query var or get var What could be the reason?? Is there any solution?? I used below codes in my functions.php file: & I already flushed permalinks. I am using custom post type I have removed custom post type base from url using a plugin. UPDATE I just noticed Its …
I have three different Custom Post Types: Company Employee Project They are connected with ACF relationship fields so as the Company can have multiple Employees and each Employee can have a project attached. The get_field() function retrieves attached post objects to create some sort of relationship. What I need to do is create three permalink structures for these CPT: For Companies: www.somepage.com/%company_name% For Employees: www.somepage.com/%company_name%/%employee_name% For Projects: www.somepage.com/%company_name%/%employee_name%/%project_name% What I have already managed to do is to set permalink structure …
This is an extended question from Permalink for CPT with taxonomy I am building a website that has a CPT and a few custom taxonomies. Each single CPT post is basically "a question" for student to practice with. I would like to setup a "taxonomy filter page", so user can quickly find the one they are looking for in the right categories. I am creating a "CPT & Taxonomy filter" page to serve this purpose. Note that the CPT archive …
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%', '(.*)' ); } However there are only a set number of %psubject% values. But the regex below, which I have tested on regex testers does not work …
I am almost tearing my hair out trying to get to grips with the Wordpress rewrite rules and tags. From within a plugin, I've created a page called 'childpage', it is the child of another page called 'parentpage'. On this page, a query var 'lbc' is passed and is always a 6 char hex value, like a color value used in html/css. So this url works fine: example.com/parentpage/childpage/?lbc=a1b2c3 There is also another page called 'otherpage', which also takes a query …
Can anybody just let me know if this is possible for the start? I have Custom Post Type "Recipes" and a Custom Taxonomy "Type", which consist of multiple items: breakfast, snack, lunch, dinner. If I create a new recipe (example = "chicken-soup") and I assign it to multiple items (example "lunch" and "dinner"), is it possible to have the next URL structure? /recipes/lunch/chicken-soup /recipes/dinner/chicken-soup Right now, I can assign multiple items, but only primary item will have a URL - …
Problem specification I'm implementing a website that is meant to host podcast shownotes and transcripts, and so I want custom permalinks and shortlinks for the webpages: Permalinks of the form /podcasts/<episode_number>/<episode_title>, e.g. /podcasts/12/news-for-august Shortlinks of the form /<episode_number> that redirect to the permalink, e.g. /12 redirects to /podcasts/12/news-for-august. Ideally, partial or "incorrect" URLs that unambiguously match the permalink structure should redirect to the corresponding podcast permalink, e.g. the following should redirect to /podcasts/12/news-for-august: /podcasts/12 /podcasts/12/incorrect-title We use a custom post …
Am using a third-party plugin for listing schools. Custom Post Type = school Custom Post Taxonomy 1 = school_type (eg. values = Primary, Intermediate) Custom Post Taxonomy 2 = school_location (eg. values = Auckland, Otago) In my current setup, each school (individual posts) can be accessed like this: http://example.com/school/snells-beach-primary http://example.com/school/murrays-bay-intermediate ...etc And URL of school types taxonomy would look like these: http://example.com/school_type/primary http://example.com/school_type/intermediate ...etc URL of school locations taxonomy would look like these: http://example.com/school_location/auckland http://example.com/school_location/otago ...etc What am trying to …
In WP 5.4.x, I was able to add a number to the URL for any page, post, etc. (incl. custom post types), which WP interpreted as the 'page' for a multi-page post, even if that page or post didn't actually have multiple pages. I assume that this was some kind of shortcut for /page/12345/ I could, for instance, open /some-page/12345/, even if that page didn't use a "nextpage" tag. The behaviour also worked for custom post types, e.g. WooCommerce products. …
Ive just been reading @gmazzap s reply about wordpress matching URLs with trailing tildes. and could do with some help please. As a coding newbie, I am not sure where to add his suggested code: add_action('init', function() { add_rewrite_tag( '%postname%', '([^~/]+)', 'name=' ); }); Functions.php, /includes/rewrite.php, or somewhere else... Also what are the implications of doing this, when wordpress updates, will these changes be lost? Am running a child theme. Sorry to ask such basic questions. Thanks for your help.
I am using woocommerce and have some 'product attributes' which are just a taxonomies. I have the following taxonomies: pa_color pa_material pa_style the pa_ stands for product attribute and it is built-in to WooCommerce handles these taxonomies, so I can't change that. WooCommerce also comes with product categories (product_cat) and product tags (product_tag) taxonomies. the following query gets me all the Red, Vinyl products in the Fabrics product category ?product_cat=fabrics&pa_material=vinyl&pa_color=red I'd like to turn this into a pretty permalink, something …
I have a custom post type that I'd like to have a permalink slug based on its taxonomy. All the posts of this CPT have one, and only one, term always marked on this specific taxonomy. That's my code: function plugin_domain_register_post_type(){ add_rewrite_tag('%event_segment%', '([^&]+)'); register_post_type( 'event', array( 'public' => true, 'rewrite' => array( 'slug' => '%event_segment%'), 'has_archive' => false, 'hierarchical' => false, 'supports' => array( 'title', 'thumbnail') ) ); } add_action( 'init', 'plugin_domain_register_post_type' ); function plugin_domain_permalinks($post_link, $post) { if (is_object($post) && …
I've created custom permalinks for various custom post types on a website. They all worked. Until recently I added another one, which I cannot get to work 8-o. The "company" struct is not working and gives a 404.. Can anyone spot a flaw in my thinking or put me on the right track? I must be forgetting something very stupid ;-) Oh, I also went to the permalink settings page to flush the old permalinks / permalink cache / ... …
I have a taxonomy called Section and a Custom post type called Developments. What i need to achieve is a permalink on the taxonomy with custom post type prefixed: e.g: custom post type: development <- More than one custom post type so needs to be dynamic taxonomy: section term: casting http://site.com/development/section/casting What i have at the moment: taxonomy: section term: casting http://site.com/section/casting Permalink Structure: Post name PS* Any help will be much appreciated: // Register Section taxonomy for Development, Pre-Production, …