Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
vexicon
tagDiv Member

This is what I ended up doing to resolve the problem.
function properid() {
global $wp;
$url = home_url( $wp->request );
$correct_post_id = url_to_postid( $url );
return $correct_post_id; // returns post id for current post
}

vexicon
tagDiv Member

i spent a couple hours pulling my hair out trying to figure out why my string was empty before realizing it was getting the template id and not the post id, here is a work around i’m using

function metavalue() {
global $wp;
$url = home_url( $wp->request );
$correct_post_id = url_to_postid( $url );
return $correct_post_id; // returns post id for current post
}

hope it works for ya, good luck.

vexicon
tagDiv Member

i have the same issue, i can confirm that get_the_ID(); the_id(); $post->ID; will all return the template ID not the ID of the actual post.

Viewing 3 posts - 1 through 3 (of 3 total)