It would be really easy if function names would automagically be linked to the codex, the function reference or the Trac browser. If someone could create a solution that does this via Javascript, we could probably convince the powers that be to add it here (if Math Overflow can have MathJax to format formulas, surely we can have something too!).

  • Cool feature, indeed.
    – Ignacio
    Aug 12, 2010 at 14:43
  • I don't know if it should be automatic though, as could pick up false positives, but maybe some sort of tag to do it? Aug 12, 2010 at 14:52
  • 3
    Well, we use backticks ` to mark code snippets ... maybe automatically highlight/link functions that are contained within backticks ... and use a tilda ~ or something similar to mark functions when they're used as a standalone references.
    – EAMann
    Aug 17, 2010 at 15:18
  • Great idea. Where are we on this?
    – editor
    Feb 14, 2011 at 20:26
  • @editor: Not very far! It would require someone to take up the work and write a Javascript implementation that does this. After some of us start using it (first as a Greasemonkey script), we can try to confirm the site owners to include it by default.
    – Jan Fabry
    Feb 17, 2011 at 13:46

5 Answers 5


Now that my QueryPosts (meta) WordPress code reference site had launched - in case connecting to Codex is complicated or not preferable... I will be very, verrrry open to provide such API to be used by WPSE. :)

  • Would it not be a problem that your site is not open source nor community driven like the actual codex ?
    – Wyck
    May 14, 2012 at 5:50
  • 1
    While nice in theory (and a very generous offer), I think, long-term, it would be preferable to connect directly to the Codex. Perhaps we could use queryposts.com as a temporary fix, and as a way to work out the script/API issues from WPSE's end? May 14, 2012 at 14:43
  • I am just throwing this as one of the options. It's true that QueryPosts is my site, but that also means that it will be more open and flexible towards working with WPSE than Codex. Anyway there had been little traction on this issue, so I am not sure if this ever happening anyway.
    – Rarst
    May 14, 2012 at 15:13

I think it would be great if posters would include more links to the things they reference in-line with their questions. Makes the site much more useful. I feel like the WYSIWYG tool is pretty explicit, and I would prefer it NOT to add links if I don't want it to. Also, links are not allowed within a block of source code.

Maybe another thought would be to have named functions listed after the answer or question, like:

Functions referenced in this answer: is_admin(), wp_enqueue_script()

... with each one linked?

  • 1
    That's a nice format. I looked at the list of the function reference, and there are 3698 functions defined in WordPress, totaling 56308 characters. This should be doable in a single JS file. Who wants to give it a try?
    – Jan Fabry
    Aug 12, 2010 at 18:18
  • I've almost finished doing it.
    – nobody
    Aug 12, 2010 at 18:47
  • One small thing which I've just noticed is with is_page and is_paged - what should I do here? I'm regex'ing out the function names and so is_page is matching the function is_paged()
    – nobody
    Aug 12, 2010 at 19:10
  • @Thomas, maybe try a backwards (lookbehind) regex?
    – EAMann
    Aug 17, 2010 at 15:20
  • 1
    @EAMann, I have a solution in my head, I just haven't found enough time to go through and change the current code yet.
    – nobody
    Aug 17, 2010 at 16:40
  • 2
    @Thomas: Is your code public anywhere, so others can base their work on it?
    – Jan Fabry
    Sep 25, 2010 at 7:54

I have inquired about this in mod room and it was suggested as first step that easy to use endpoint would be strong requirement to consider this.

Function pages in Codex follow specific title

Function Reference/the content

and URL structure:


Since Codex is is powered by MediaWiki it exposes its API and it is possible to query for a page by title:



<?xml version="1.0"?>
      <n from="Function_Reference/the_content" to="Function Reference/the content" />
      <page pageid="765" ns="0" title="Function Reference/the content" touched="2012-01-03T22:52:29Z" lastrevid="110295" counter="18814" length="4259" fullurl="http://codex.wordpress.org/Function_Reference/the_content" editurl="http://codex.wordpress.org/index.php?title=Function_Reference/the_content&amp;action=edit" />

If page is missing:



<?xml version="1.0"?>
      <n from="not_a_function" to="not a function" />
      <page ns="0" title="not a function" missing="" fullurl="http://codex.wordpress.org/not_a_function" editurl="http://codex.wordpress.org/index.php?title=not_a_function&amp;action=edit" />

Response format can be customized, as well as other properties. I am not very proficient with it, just put this together from API docs.

  • Just dropping a note that this is still being investigated. Sorry for the delays. ♪
    – Grace Note StaffMod
    Feb 24, 2012 at 15:09

We could start creating tags for functions and include the Codex Url in the tag wiki.

It would also give you a list of all questions about the function by clicking hovering over the tag.


I made a tag wiki edit for Using the same format as Rarst's queryposts.com format.

The Stack Exchange javascript already includes a regex parser for turning [tag:some-tag] into so it shouldn't be impossible to add something similar using http://codex.wordpress.org/Function_Reference/tagged_function as the url to output. We would also have to convert - to _ since our tags use a hyphen instead of an underscore.

Stack Exchange tag parsing regex function:

function(b, c, d, a, g, i) {
        for (var j = $(b).val(), p = sanitizeAndSplitTags(j, !0), s = !1, q = 0; q < p.length; q++)
            0 != $.trim(p[q]).length && ($©.children().each(function() {
                $(this).text() == p[q] && ($(this).fadeTo(500, 0.1).fadeTo(500, 1), s = !0)
            }), s || (j = $.URLEncode(p[q]), $©.append('<a id="' + p[q] + '" href="/questions/tagged/' + j + '" class="' + a + '" title="show questions tagged \'' + 
            p[q] + "'\">" + p[q] + "</a> "), e(d)), s = !1);
        g && $(b).focus();
        i || f(d, $©.text());
  • I would be against tags and manual maintenance of those for such purpose. Codex can't get close to complete function reference, we wouldn't be able to reach a fraction of Codex coverage in this fashion. The point of auto-linking is computers doing all grunt work. Getting human in the chain is compromise that shots the process (as it does for Codex in my opinion).
    – Rarst
    May 18, 2012 at 11:08
  • Have you ever looked at the Geshi syntax highligher? I was playing with over the weekend and created a WordPress language file that links every function to codex in the code block. It uses a keyword parser that is slow with all WP functions in it but could be trimmed down.
    – Chris_O
    May 29, 2012 at 21:43

I'm tagging this as a favorite so I can quickly get back to this URL via meta:

  • http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/post-template.php#L775

Or more generally:

  • http://core.trac.wordpress.org/browser/tags/<version>/<file path>#<line no.>

You must log in to answer this question.

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