5

For the initiative adopt a tag I decided to adopt <url-rewriting> and related tags.

I've started yesterday tasting the territory and, really, it's a mess.

I'm asking here to decide a rule I've to follow to make order in it.

Existing tags

Actually existing related tags are:

  • <url-rewriting> (with synonym <rewrite>)
  • <rewrite-rules>
  • <mod-rewrite>
  • <add-rewrite-rule>
  • <rewrite-tag>

The first 2 tags, seems the most important to me, in particular I think that all the questions regarding WordPress way to handle url rewriting should be tagged <rewrite-rules> (or maybe <rewrite-rules> and <url-rewriting>) and instead use <url-rewriting> only for questions about non WordPress rewrite rules, just like the ones in .htaccess.

Regarding <mod-rewrite> to me it seems an irrilevant tag, because it's too generic and less informative.

Last two tags, on the countrary, seems too narrow to me, I don't think it's useful tagging asnwers using specific function names, even because, just as example, a lot of questions using add_rewrite_rule are answered using add_rewrite_endpoint and so on...

Siblings tags

I noticed that when a question has <url-rewriting> and related tags, very often there are also tags like <urls> and/or <permalinks>. What to do with this tags? I'd like to follow same rule for all questions, so if we decide to leave where they are, I should also add where they don't are, on the countrary, I should remove them everywhere. Sincerly I am for second alternative.

Another common sibling tag is <htaccess>. I think this tag is ok when Q is about edit .htaccess file directly, should be removed anywhere else. In first case I think is better add the 2 tags <url-rewriting> and <htaccess> and remove <mod-rewrite>


Specific Cases

There a lot of questions regarding the url rewrite api of WordPress, but not involving rewrite rules directly a probably not comprehensive list is:

  • questions about rewrite params of register_post_type and register_taxonomy
  • questions about removing/adding/editing permalink base for various archives

How properly tag these sort of questions? I thing <url-rewriting> should be the right choice. Are these questions use cases for <urls> and/or <permalinks> tags?

Last my trouble regard questions asking something I call reverse rewrite, i.e. taking a pretty url and convert it in a url with query string, not necessarily the url the WordPress related one, e. g. take an url example.com/a-random-string/ and rewrite it in example.com/?foo=bar&bar=baz.

The questions are various tagged, sometimes they have all possible tags: <url-rewriting>, <htaccess>, <mod-rewrite>, <urls>, and so on..

I've answered a couple of these questions suggesting a redirect instead of a rewrite rule, but in substance, which is the proper way to tags these questions?


Edit

After responses by @ChipBennett and @Rarst, in substance, what I suggest is:

  • delete tags <add-rewrite-rule>, <rewrite-tag> and <mod-rewrite>
  • add a new tag <rewrite-api> as suggested by @ChipBennett, then make <rewrite-rules> synonym to it
  • use <rewrite-api> for all questions regarding any function or hook of rewrite api and also for question regarding the 'rewrite' param of cpt/taxonomy registration
  • use <url-rewriting> for questions regarding rewrite rules not generated by WP. In these questions also use <.htaccess> tag if relevant
  • Remove tags <urls> and <permalinks> from from questions where only rewrite rules are involved
  • use <rewrite-api> also when questions are about to extract query vars from pretty permalinks (and remove <urls> and <permalinks> if present)
  • use <urls> when question are about convert a pretty url in a url with query vars not regarding WP e.g. mysite.com/a-page/ to mysite.com/myapp/my-file.php?myappvar=foo

4
  • 4
    Protip - use [tag:tagname] for automagically linked tags in posts.
    – Rarst Mod
    Commented Nov 10, 2013 at 13:50
  • "use <url-rewriting> for questions regarding rewrite rules not generated by WP" - would such questions be in-scope for WPSE? Commented Nov 13, 2013 at 12:59
  • @ChipBennett maybe not, but actually there are a lot of questions regarding rules manually added in .htaccess. Once these questions exists, I think I have to tag them. (I can also vote for close them, but does it make sense?)
    – gmazzap
    Commented Nov 13, 2013 at 13:37
  • I don't think we necessarily need to worry about taxonomy for off-topic questions. Commented Nov 13, 2013 at 13:46

3 Answers 3

1

Methinks you ought to keep or create add-rewrite-rule, rewrite-rule, add-rewrite-tag, rewrite-tag, etc. and make them synonyms for rewrite-api. They're all named after WP functions or WP rewrite API concepts, and users who are looking for someone who knows them probably enter them as tags as a result.

Other suggestion: in the event the permalink tag has a different accepted meaning, create a permalink-api tag if there is none, and make it a synonym to the latter group.

Lastly, I'd suggest bundling htaccess with mod-rewrite, and other apache-related tags if any. Many of them are probably off-topic, too, but the tag is still worth keeping them around.

Not sure about the other tags. Good luck. :-)


Side note: when I start typing "wordpress add_rewr" in Google, the latter suggests "wordpress add_rewrite_rule not working" as second option. This has a familiar ring to it, no?

6
  • I don't understand the need to create some tags and then make them synonyms for something. Because to tag answers using function names is a wrong concept and, I think, if users can attach tags named like function names can also attach rewrite-api.
    – gmazzap
    Commented Nov 13, 2013 at 8:48
  • Wrong concept or not, the add-rewrite-rule and a whole bunch of others exist because it's the name of a WP function that users entered while looking for answers related to whatever function they're having problems with. Ergo, having the relevant tag around and making it a synonym of a broader group is probably good idea: the tag will then pop up when the end-user enters it, and it'll get translated automatically to the synonym. No? Commented Nov 13, 2013 at 8:59
  • And, no, in my own experience from back when I was running my private support forum, users don't attach tags like rewrite-api when they enter tags named after functions. They stick to entering a task named after the function they're trying to deal with from lack of knowing better. If anything, they usually have absolutely no idea that there's a more general tag that fits their question better. Commented Nov 13, 2013 at 9:01
  • I have no experience on support forums, but I know new and low rep users can't create new tags and if they have enough rep., they should know what rewrite api is. So, when a new user try to add add-rewr... tags, rewrite-api is the only suggestion shown if functions named tags doesn't exist. IMHO this is a way to force new users to use proper tags. There 2 reasons why I said is wrong to use function names as tags, the 1st is explained in my question, the 2nd is a comment by @toscho that found me completely agree: "We should try to focus on the concept, not on function names"
    – gmazzap
    Commented Nov 13, 2013 at 9:15
  • Hit "Ask a question" on the WPSE, and see what happens when you type "over" in the tags list. As I write this, you'll see "pluggable" appear because it's a synonym of "overridable-functions". As you can see, it's running a like '%word%' type of query. If an end-user starts typing "add-rewrite-rule" it should similarly yield "rewrite-api"; this can only be done by making the tags synonyms. If you still think the idea is silly and useless, I'm afraid I've no help to offer. (Except to highlight that unicorns don't exist any more than hapless end-users who know what to type in advance.) Commented Nov 13, 2013 at 10:09
  • You are right, my bad, if user type "add-rewri", rewrite api doesn't appear, it appear if user start typing "re..", "url r..", "url.." (once I want to make url-rewrite a synonym to rewrite-api as said in Q). This is enough for me. It's an opinion, if I was sure it's the right opinion I would not posted a question here. What I believe is silly is to create tags with the only aim to make the synonyms to other tags. Following this rule we should create synonyms for all existing tags that users maybe can type in different ways.
    – gmazzap
    Commented Nov 13, 2013 at 10:57
0

I would recommend using Rewrite API as the master tag name, and then mark all the rest as synonyms.

I think this tag is appropriate for either direction: taking URL query args and converting them to pretty permalinks, and taking pretty permalinks and extracting URL query args.

2
  • For taking URL query args and converting them to pretty permalinks I'm always agree, for taking pretty permalinks and extracting URL query args, not always: sometimes people want to send variables not related to WP to custom application in those cases rewrite api is not the right tag for me. However, I updated the answer.
    – gmazzap
    Commented Nov 10, 2013 at 14:21
  • "sometimes people want to send variables not related to WP to custom application..." - I would argue that such questions, as per our FAQ, are off topic for WPSE, because they are questions not specific to WordPress, merely taking place in the context of WordPress. Commented Nov 10, 2013 at 22:37
0

It is hard to untangle this because rewriting URLs in WP involves:

  • PHP code dealing with adding rewrite rules
  • PHP code dealing with applying rewrite rules
  • regexp of actual rules themselves
  • mod rewrite rules generated by WP
  • mod rewrite rules not generated by WP
  • any crazy combination of any of the above

Since there are pretty much two possible actions to deal with tag (delete and make synonym) it would be productive if you formulated suggestions accordingly ("let's delete tag because..." or "let's make tag synonym to another tag because..."). Would make it easier to consider and agree/disagree with specific parts.

1
  • Thanks Rarst, I've updated the answer.
    – gmazzap
    Commented Nov 10, 2013 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .