• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    https://codex.www.ads-software.com/index.php?title=Special:UserLogin&returnto=Special:UserLogout

    Thread Starter MartyThornley

    (@martythornley)

    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?

    Thread Starter MartyThornley

    (@martythornley)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trouble editing codex page.’ is closed to new replies.