Can't get Current PostID From Widget within Cloud-Template

Posted in: Newspaper
Post count: 4

Hi Everybody,

Since a few days I am using a Post Cloud-Template with a right Sidebar. I am using a Self-Made Plugin as Widget and was able to read the current Post ID with get_queried_object_id().

With the usage of the new Cloud Template I can’t access the POST ID anymore and just get the Template-ID in Return.

Is this a bug or how is it possible to get the POST ID now inside a Widget within a Cloud-Template?

Thanks!

Post count: 22421
Post count: 4

I’ve tried everything from the list above, nothing worked. Returns the Template ID not the POST ID.

Post count: 4

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.

Post count: 4

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.

Post count: 4

Thanks for the workaround. I will try it out the next days!

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.