Try
global $post;
echo $post->ID;
or (I don’t know the difference)
global $wp_query;
echo $wp_query->post->ID;
Related Posts:
- How to get page title with the page ID?
- What is an alternative to get_page_by_title()?
- Get page id by title?
- Cannot get grandparent object
- Making audio playlist by getting page’s parent’s ID
- How to get page_id for url rewrite or how to use page slug for calling a page?
- Is it possible to restrict access to specific pages in the admin area based on the page slug?
- List child pages within page template
- How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?
- Get ID of the page where shortcode is included
- get id custom tables on current page
- Custom templates not showing up in template dropdown
- Allowing user to edit only certain pages
- Access the same page from multiple urls (wildcard)
- Add a Page without header and menus?
- Find empty pages or pages which have less than x characters
- Prevent WordPress from adding linebreaks to javascript embedded in a page
- Hide page visual editor if template is selected – redux
- Too many pages causes WordPress admin to be unusable
- Page template gives ‘Parse error: syntax error’ when used, but no error found!
- more tag in the $post->content when get_pages were used
- How to get the list of posts in a static page other than front page?
- Using JavaScript and JQuery in Page
- How can I make Disqus comments not show up on pages?
- CMS: Making complex pages editable by the end user
- Show child pages when on a child page
- Sitewide page on all the blogs in the network
- How to display thumbnail and excerpt of a page on homepage?
- How to create a page when a theme is activated?
- WordPress Admin – Add Edit link to specific page under Pages Menu
- Show child pages and sibling pages on the child page
- How do I use featured images on index.php?
- Creating a form contact page?
- Problem With Pages Displaying
- Removing the TinyMCE editor for a given page template
- How to call wp_list_comments() outside of the comments template?
- Missing Pages (Drafts?)
- WordPress redirects me to posts page after editing one page
- Getting to a specific page on website using specific code instead of navigation bar
- Can’t see content on page to edit
- Show own shortcode data on each page
- How can I get the homepage from the loop?
- Suddenly forbidden 403 error on some pages
- How do I Name a WP page in the New(ish) Block Editor?
- How to select a specific page
- Where can i make an html change to a specific page [closed]
- JQuery Plugins in WordPress
- This code won’t find authors page?
- WordPress backend:How to hide some specific pages under Pages–>All Pages
- Different header for each page in child theme of twenty thirteen
- Change a Page’s Header Image
- Use content from one page in another template
- How do I edit text displayed on my browser tab?
- Is it possible to change slugs’ default behaviour?
- Page menu not showing in admin, new Page button missing in toolbar too
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Order by modified date working in POSTS but not PAGES
- append one page content into another
- WordPress Page doesn’t load the template selected
- on page creation few inline style properties gets removed
- Custom folder for wordpress page templates
- way to make all pages with certain tags public?
- Page not appearing under its Parent
- Can I use Pages like a Wiki
- list child-pages as normal pages?
- return page name in url
- Create multiple pages with tables from json file
- Search anything from a Child and Sub-Pages of their Parent page
- Can i use 2 page content-forum & content-forum-slug on bbpress?
- Attaching a file to a page without adding to media library?
- Change page width in refined magazine/mag and news theme
- How do you run code on a specific page without missing the init hook?
- Requiring a Visitor to Enter a Password Each Time They visit a Page
- if is_page() is not working with wp_redirect
- Display meta data attribute in user profile
- Assign Parent Page – Now 404 Error
- WordPress displays widgets out of whack
- WordPress form submit to custom page template does not work
- Two different layouts for the same post
- My page title turns into a h2 tag – What to do?
- How do I locate a third party page represented as a slug in my WordPress website?
- Customise the_title in admin area
- Add pagination to search.php page
- problem with loading pages
- Content not displaying on page
- Blank white space where header was [closed]
- How do I get my page “About” to show up on my WordPress site?
- Display child pages on homepage template
- Set order acs and no paging for archive page
- Pageview all of sudden not working
- Childpage title + content on Parent Page
- Get page content by ID (from a plugin)
- Pulling posts tagged with similar title name
- Filter posts by author selected in page
- Temporary download page or restrict static download page based on how the user got to the page?
- List Parent page with sub pages
- Custom post page has attributes of latest post [closed]
- wordpress user profile page
- WordPress is picking up links that don’t exist
- how can i get the page_ID in nav li [closed]