• Resolved zohair90

    (@zohair90)


    Hi,

    I need to access the current post ID in PHP template/render-callback for the editor.
    My code is working fine in the front end, but in the editor screen i am unable to access the current post id. I tried below:
    global $post;
    $_GET[‘post’];
    but still unable to get the post id. Is there a function/property which i need to call to get the current post id. Please let me know even if there is any work around for this. Need help on this as it URGENT.
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter zohair90

    (@zohair90)

    Waiting for a reply. Any help is appreciated.

    Plugin Author Nikita

    (@nko)

    Hey.

    Thank you for reporting to me. This problem will be fixed in the coming plugin update.

    Regards, nK.

    Thread Starter zohair90

    (@zohair90)

    Hi @nko,

    Welcome. I used the code below for the time being, incase any one wants a temp solution until its get fixed in the plugin itself.

    parse_str(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY), $queries);
      $post = get_post($queries['post']);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get current post ID in block template(PHP) on edit screen’ is closed to new replies.