WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] The $post->ID is not correct on some pages

[Resolved] The $post->ID is not correct on some pages

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    @esmi

    Forum Moderator

    Um…. category/archive pages don’t have post ids.

    gagnonconsulting

    @gagnonconsulting

    OK, thanks. I guess I was given some bad info. Basically, I am trying to redirect to a specific URL if the ‘direct_jump’ metapost data value of a post is set (to a URL) when I click on a post link. Any idea how to do this?

    esmi

    @esmi

    Forum Moderator

    You could use conditionals first – is_category(), is_single etc. Then based on the results, test on post id or cat id etc.

    http://codex.wordpress.org/Conditional_Tags

    Thank you, that does the trick. I am still getting confused as to which type of pages I am looking at (archive vs. category vs. post, etc.) but going through the codex functions reference is helping.

    Thanks for your help on this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] The $post->ID is not correct on some pages’ is closed to new replies.