Shortcode not displaying where I am typing it
-
I am trying to use short code to display the post id inside a post, however when I use [id] it is showing the post ID at the start of the post of the post content, not where I have typed it.
The shortcode I am using, I have placed this in the plugin folder.
function shortcode_id() { $id = the_ID(); echo $id; } add_shortcode('id', 'shortcode_id');
What displays on the post page: 10741This is a good post. This is Post ID:
I also tried:
echo the_ID();
but it doesn’t work either.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Shortcode not displaying where I am typing it’ is closed to new replies.