Skip to main content
added 188 characters in body
Source Link
Anton Lukin
  • 887
  • 5
  • 17

If I understand correctly the question, the right answer would be to use url_to_postid function.

Then you can setup post id this way:

global $post; 
$post = get_post($post_id, OBJECT);
setup_postdata($post);

// your code

wp_reset_postdata();

If I understand correctly the question, the right answer would be to use url_to_postid function

If I understand correctly the question, the right answer would be to use url_to_postid function.

Then you can setup post id this way:

global $post; 
$post = get_post($post_id, OBJECT);
setup_postdata($post);

// your code

wp_reset_postdata();
Source Link
Anton Lukin
  • 887
  • 5
  • 17

If I understand correctly the question, the right answer would be to use url_to_postid function