Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Template:Trac



Description

Link to the source code on https://core.trac.wordpress.org/browser/.


Usage

{{Trac| $file_path | $branch_tag_trunk }}


Parameters

1 - $file_path
(string) (required) Path to file.
Default: None
2 - $branch_tag_trunk
(string) (optional) Path to 'branch version', 'tag version' or 'trunk'.
Default: tags/{{CurrentVersion}}
3 - $line
(string) (optional) Line in source file where tag is declared. Required $branch_tag_trunk parameter tags/version
Default: None

Usage

Link to the latest stable version:

{{Trac|wp-includes/version.php}}

Output: wp-includes/version.php

Link to trunk:

{{Trac|wp-includes/version.php|trunk}}

Output: wp-includes/version.php

Link to branch 2.9:

{{Trac|wp-includes/version.php|branches/2.9}}

Output: wp-includes/version.php

Link to tag 3.0.1:

{{Trac|wp-includes/version.php|tags/3.0.1}}

Output: wp-includes/version.php

Link to tag 3.0.1 line 3:

{{Trac|wp-includes/version.php|tags/3.0.1|3}}

Output: wp-includes/version.php

Link to tag 3.0.1 with link text '3.0.1':

{{Trac|3.0.1|tags}}

Output: 3.0.1


Issues

Trac tags/branches older than 3.7 do not have the wikipedia source code in the base 'src' folder. A conditional should be placed on the second parameter to check if the tag/branch is 3.6.1 or lower and not include the hard-coded 'src/' path of the URL.