WordPress.org

Ready to get started?Download WordPress

Forums

Custom permalink tag (4 posts)

  1. DaveHope
    Member
    Posted 7 years ago #

    Hello all,

    I've taken a look over tha avaliable permalink tags (http://codex.wordpress.org/Using_Permalinks) and i'd like to add one (%epoch% - to reflect the unix timestamp a page was created on) to match my current blog software.

    I've taken a look through options-permalink.php, link-template.php and rewrite.php which seem to be where the changes would need to be made.

    There are a number of things i'd like to check first tho:

    1: Is there a better way for me to implement my changes than altering those files?

    2: If I do alter them, is it worth me making a patch and submitting it?

    3: Is there anywhere else that i'be missed that I'd need to add the change?

    Thanks guys.

    Dave

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Is there a better way for me to implement my changes than altering those files?

    Yes. You can use a filter in a plugin.
    http://codex.wordpress.org/Filters

    Specifically, you need to use the 'post_link' filter for the get_permalink() function.

    You'll also need to modify the rewrite rules to allow your permalink to work. You'll probably use the add_rewrite_tag() function for this. I'm not too familiar with this code, so can't offer much help here.

  3. DaveHope
    Member
    Posted 7 years ago #

    Had a quiet evening, so have created a patch and submitted it to the wp-hackers mailing list.

  4. DaveHope
    Member
    Posted 7 years ago #

    Sorry Otto 42. Didn't notice your response. Didn't refresh the window between starting the thread and posting my follow up. Whoops.

    Thanks for your reply, will see what is said on the ML and probably end up using a Filter and ditchign my alteration.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags