Rewriting URLs in WordPress

I am trying to solve a rewrite problem but don’t fully understand how to read the below code. I believe the event/industry/(.+)/?$’ is stating the format I want in my new url after rewritten, which should be example.com/event/industry/someterm/ And this part appears to be the parameter. => ‘index.php?post_type=eg_event&industry=’ . $wp_rewrite->preg_index(1) Is this a correct understanding? … Read more

URL endpoint with HTML

I’m using WordPress endpoints to render another template on a post page. How can I add .html to the end of the URL that using the endpoint? Example: Normal URL: example.com/angry-birds Normal URL with endpoint: example.com/angry-birds/play Here are the results I’m trying to achieve: example.com/angry-birds.html and example.com/angry-birds/play.html 0

add new permalink structure from dynamic page

I created page “play” url: http://localhost/myweb/play and inside of page “play” I include PHP code to make the new search from outside WordPress. And all worked, if I search from my page “play” the url will be: http://localhost/myweb/play?m=text+Search&pageno=1 Now, I want my search result url to be fancy url, like: http://localhost/myweb/play_text_Search_1.html I have tried several … Read more

Incorrect 404 for pages when using permalink, a static front page, and posts page

I am having an issue with my permalink setup, which I think has to do with my setup, rewrite rules, and more. Under Settings->Reading, we have a static Front Page set as well as a Posts page (Home and News, respectively). Under Settings->Permalinks, I have a custom one set up as /news/%postname%/. Basically, I want … Read more

Is it possible to generate an alternate structure for multi-tag urls?

I know that one can query multiple tags with the + syntax, as in www.example.com?tag=?test+test2+test3 I’m looking for a solution where the URL would be in this format instead: www.example.com/foo/test/test2/test3 Can anyone give any tips how best to arrive at this solution? 1 Answer 1 You might be able to pull something together using: http://codex.wordpress.org/Rewrite_API/add_rewrite_rule … Read more

Is there a ‘rake routes’ for wordpress?

Is there an equivalent to ‘rake routes’ in php/wordpress that would spit out all the available wordpress url paths available? 1 Answer 1 var_dump( $GLOBALS[‘wp_rewrite’] ); this is as close as you’ll get. Anyway, there’re plugins like the “MonkeyMan Rewrite Analyzer” and toschos T5 Rewrite plugins that will allow you other nice things too.

How to show in search results posts with a particular tag in a particular category?

As the home page of my blog I’ve a static page. There I want to show the navigation of the site. Category1 Sub-Category1 tag1, tag2, tag3 Category1 Sub-Category2 tag1, tag2, tag3 Category2 Sub-Category1 tag1, tag2, tag3 Category2 Sub-Category2 tag1, tag2, tag3 All the above words are hyperlinks. Now what I need is, when a user … Read more

Pagination problem

I have two custom rewrite rules: add_rewrite_rule(‘foo/bar/?’, ‘index.php?post_type=foo’, ‘top’); add_rewrite_rule(‘foo/bar/([a-z]+)/?’, ‘index.php?post_type=foo&bar=$matches[1]’, ‘top’); Which gives me posts that match a custom variable bar. However, I want to handle pagination too, thus when a number succeeds /bar/ wordpress should treat it as a page number. I wrote: add_rewrite_rule(‘foo/bar/([0-9]+)/?’, ‘index.php?post_type=foo&paged=$matches[1]’, ‘top’); In my custom function which is attached … Read more

One WP install, I need to map a custom domain name to each category

I’ve read other answers but they weren’t satisfactory. Multiple blogs, different domain names, one install to rule them all Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive I did try the second option as it seemed perfect for my needs, however, what happens is that while a … Read more