Forums

Trouble editing codex page. (4 posts)

  1. MartyThornley
    Member
    Posted 2 years ago #

    Saw a little confusing item here about the get_post() function.

    Tried to edit but it said editing was limited members of the group 'users' and had link here.

    But that page said the group doesn't exist.

    Confusing item was this:

    It describes the function as get_post( $post, $output ) where $post should be an ID. But $post is a variable used by WordPress in the loop. and that is not what is being passed to that function.

    Would be better if it read get_post( $id, $output )

    Is the object returned by this function the same object commonly used as $post in the loop? If so, that makes this doubly confusing.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    get_post can take the ID or the object (e.g $post).

    As for editing Codex, you do need to create an account and login before editing an article.

    http://codex.wordpress.org/index.php?title=Special:UserLogin&returnto=Special:UserLogout

  3. MartyThornley
    Member
    Posted 2 years ago #

    I had (have) an account and had contributed before. That's not the issue.

    My point with $post vs $id is the wording of the article. To say give this function the id, then use a global variable like $post is confusing.

    Also, if it is true what you say about being able to use either the object $post or the integer $id, why doesn't the description say any of that? In fact it is very specific saying that it must be an integer of a post's ID.

    Anyway, I see someone has edited it tp make more sense. Thanks to whoever that was. :)

    Michael - if you are correct about being able to use $post or $is, maybe you could add that info, since it is nowhere in the current text?

  4. MartyThornley
    Member
    Posted 2 years ago #

    btw @MichaelH...

    That info about being able to pass get_post() the global $post object as well as the the id appears to be wrong.

    Look at the function definition itself. It requires the integer of the post's ID.

Topic Closed

This topic has been closed to new replies.

About this Topic