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 [...]
↧