wordpress page id in friendly url olatechproFebruary 16, 20232 Views How to get the page id in wordpress in the case of friendly url? Post Views: 2 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
Inside the Loop: http://codex.wordpress.org/Function_Reference/the_ID Outside the Loop: global $wp_query; $id = $wp_query->post->ID; Log in to Reply
I’m guessing you’re talking about doing it via the Admin interface. Can’t you just add it into the custom format textbox using the %post_id% string: /archives/%post_id% Log in to Reply
If you are within the Loop (most of the time meaning within the while(have_posts()) you should be able to use: global $post; $id = $post->ID; to get the ID Log in to Reply
Inside the Loop: http://codex.wordpress.org/Function_Reference/the_ID
Outside the Loop:
global $wp_query; $id = $wp_query->post->ID;
I’m guessing you’re talking about doing it via the Admin interface. Can’t you just add it into the
custom format
textbox using the%post_id%
string:If you are within the Loop (most of the time meaning within the
while(have_posts())
you should be able to use:global $post; $id = $post->ID;
to get the ID