Quantcast
Channel: codefx.biz » example
Viewing all articles
Browse latest Browse all 13

Retrieving the current $post->ID on hook ‘init’

$
0
0
Within a WordPress theme it’s no problem to get the current post_id, but when it’s plug-in code which is hooked to the ‘init’ event – object $wp_query doesn’t exist yet. Following example demonstrates how to get the ID, even when permalinks are enabled: When permalinks are disabled, it’s no problem at all to get the [...]

Viewing all articles
Browse latest Browse all 13

Trending Articles