Articles of permalinks

Why can posts never have a number as the link?

Here’s something interesting I noticed today – it is not possible to name a post a number – no matter what theme you use, and even if you name a post a long number that has no tag or post-name or category name conflicts, you will still get 2015 or 1826628 renamed as 2015-2 or […]

Rewrite rule to prettify two $_GET variables while in a new endpoint from a page

I’m trying to create a permalink rule which is a few levels deep. I have a basic page /page-slug/ – I’m appending to it a new endpoint: /page-slug/my-endpoint/ – from here I need to nest one id and one string that contain $_GET variables, such as /page-slug/my-endpoint/?some_id=123&some_string=string which should become: /page-slug/my-endpoint/123/string/ I got all the […]

How to create thousands of endpoints for a post or a page or a custom post type programatically?

Need help working with WordPress endpoints with programming to create thousands of them like: example. com/custom-pagepost-id/endpoint123 example. com/custom-pagepost-id/endpoint124 example. com/custom-pagepost-id/endpoint125 example. com/custom-pagepost-id/endpoint126 example. com/custom-pagepost-id/endpoint127

Parent & Child Taxonomy slugs in custom post permalink

I’ve registered a custom post type “book” and a taxonomy “authors” as below: add_action( ‘init’, ‘post_book_init’ ); function post_book_init() { $labels = array( ‘name’ => ‘BOOKs’, ‘singular_name’ => ‘BOOK’, ‘menu_name’ => ‘BOOKs’, ‘name_admin_bar’ => ‘BOOK’, ‘add_new’ => ‘Add New’, ‘add_new_item’ => ‘Add New BOOK’, ‘new_item’ => ‘New BOOK’, ‘edit_item’ => ‘Edit BOOK’, ‘view_item’ => ‘View […]

Remove base slug in CPT & CT, use CT in permalink

I’ve come quite far, but can’t manage to get this to work. I’d like to remove the base slug from my Custom Post Type review and my Custom Taxonomy brand. The final result should be a URL like this: https://example.org/apple/iphone7. Right now I got this: https://example.org/review/apple/iphone7. I’ve read quite a lot and I know about […]

Get the post permalink within the loop but without additional DB query

I am looking to create a custom ‘directory’ page which will link to several thousands of posts. Because of the large number I am trying to limit the number of DB queries. I notice that to link to each post, I am calling get_permalink() and this is creating an extra DB query for each post. […]

How do I get all the URLs from my WordPress site?

I see in the database where my link normally is: http://www.voomka.com/product/audio-and-video/samsung-ua55hu7000u-uhd-series-7-led-tv/ In the database, it shows only samsung-ua55hu7000u-uhd-series-7-led-tv In the “post_name” field. Which means there is some other logic that derives the full path. I need all “products” posts, full path and model number. Is there an easy way to extract this?

Custom Rewrite with Query vars

I have been stuck on this for hours and tried all these different methods but none seem to work. I’ve seen other threads with a similar problem but the solutions are not working for me. I’m hoping someone can help. I have a page with a custom template using the permalink example.com/central This page accepts […]

How can I link a file in admin with a button?

Let suppose I have made a file in my theme folder (with the name c.php) and I want it to link it with a custom button (that I have made in post/page) in admin using GET action. How can I achieve that

remove permalink “front part” for custom post type

Let’s suppose I have CPT “event”. In register_post_type, I’ve set ‘slug’ => ‘event’ Then, in WordPress settings I’ve set following Permalink structure Custom: http://www.domain.tld/news/%postname%/ The problem is, URL for my “Event” CPT is www.domain.tld/news/event/<event-name> and I want www.domain.tld/event/<event-name> how can I achieve that? Thanks