Adding Custom permalink tags in wordpress

295 Views Asked by At

Basically what i want to achieve is to add a variable ?a=uk on the end of all the links of a wordpress blog Ive tried various solutions that i have read with similar problems to no avail im ideally after setting the permalinks to be %postname%/%a%

but my efforts to create %a% as a tag have been unsuccessful.

Ive been reading round for a few days now and cant seem to get anything to work and would appreciate anyones help in this matter

2

There are 2 best solutions below

7
On

Try to set your permalink structure to this

%postname%/?a=uk

Edit: From your discussions, it seems that you don't have to modify the permalink structure at all, since external sites which are going to link to it will be including them automatically.

Edit2:

To automatically include the parameter in all the links from your page, you should hook into the get_permalink hook. You can't do it by changing the permalink structure.

1
On

Instead of modifying all the wordpress links, you should use session or cookie to handle your users location.

EDIT :

  • you should use a i18n plugin
  • or you can easily modify all your links using javascript