Articles of url rewriting

How to create download links based on Custom Fields with Rewrite API

For me this is quite hard to do, but I guess that this could be easily done by an expert. 🙂 Let’s suppose I have a post, which is a custom post type resources, with the following data: Post Slug: beach Custom Fields: dl1file: bikini dl1link: assets/file1.zip dl1count: 56 dl2file: beachball dl2link: assets/file2.zip dl2count: 31 […]

Force a specific template based on the URL

When a user browses to a URI beginning with “/forums”, WordPress should call a specified template. For example, all of these URLs: mysite.com/forums mysite.com/forums/questions mysite.com/forums/questions/1/my-question mysite.com/forums/questions/ask mysite.com/forums/users … should call the following template: mytheme/page-forums.php I believe this involves WP_Rewrite, but I have no clue what to do from here. Any ideas?

Changing RSS feed URL structure

I am in the process of creating a wordpress website, and I just have one issue left – RSS feeds. Currently, the website has a .htaccess file blocking access to /category/* pages. It was part of a requirement that the site is not obviously WordPress, and /category is a decent indicator of that. Each category […]

Change Permalink Structure for Tag.php template

Im using a custom post type to build a filterable gallery and taking advantage of the tags taxonomy within it. I am also using a custom taxonomy called years. at the moment, the permalink structure of the gallery page is www.example.com/gallery it is filtered by tags and years. i have made a taxonomoy-years.php template and […]

Creating a dynamic URL structure

I want to create a directory structure for my WordPress links and for the final page to be based on the taxonomy of the page. So I have a business that belongs to a city (meta) and country (taxonomy). I would like the final URL to be http://example.com/{country}/{city}/{post_title}/ Is this at all possible? I have […]

Custom query_vars and parse_request on wp-admin

I’ve read this post http://wordpress.org/support/topic/query-vars-in-admin and although it’s quite an old question, it suits me perfectly. I’m trying to accomplish what I already posted here: Rewrite rule for admin-ajax.php But in the code below, only the first filter gets called while in wp-admin: add_action(‘init’, array(‘MYCLASS’, ‘add_custom_rewrite_rules’), 10, 1); add_action(‘query_vars’, array(‘MYCLASS’, ‘add_custom_query_vars’), 10, 1); add_action(‘parse_request’, array(‘MYCLASS’, […]

Adding pretty query parameters

A custom post type named shooting has a field (with ACF) with plenty of images. Those are listed on the single.php of the CPT and one of those images is displayed in full-ish size. I currently have URLs like shooting/foo-bar/?image=1 where 1 is the index (not ID) of the image that should be displayed large. […]

Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?

I’ve added a myvar/myvalue rewrite endpoint to EP_ALL which can be added to any URL of a WP installation and a WP plugin will act upon it. That part is cool but it doesn’t work when the permalink structure is /%category%/%postname%/. It works well with all the built in, selectable structures. There could be other […]

Checking that the Rewrite API is available

WordPress supports URL rewriting through the Rewrite API. It relies on underlying HTTP server mechanisms to get the job done. It is not always possible for WordPress to enforce the Rewrite rules. For example, with Apache, when WordPress isn’t allowed to create the .htaccess file. The plugin I’m writing should take advantage of the Rewrite […]

How to set up Author archives with sub category URL

So i have a site where i have used the authors.php page so that i can display individual user’s profile pages.. the url then looks something like: http://mydomain.com/author/test/ What i would like to do is have it so that I can add subpages to this that are common for each user ie: http://mydomain.com/author/test/liked-posts/ where i […]