{"id":16808,"date":"2019-04-15T08:15:19","date_gmt":"2019-04-15T08:15:19","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=16808"},"modified":"2026-11-05T09:04:41","modified_gmt":"2026-11-05T09:04:41","slug":"wordpress-post-id","status":"publish","type":"post","link":"\/my\/tutorials\/wordpress-post-id\/","title":{"rendered":"How to find WordPress post ID and page ID"},"content":{"rendered":"<p class=\"wp-block-paragraph\">To find a WordPress post ID or page ID, go to <strong>Posts &rarr; All Posts<\/strong> or <strong>Pages &rarr; All Pages<\/strong> and hover over the title. In the URL preview, the number after <code>post=<\/code> is the post or page ID. You can also open the post or page in the editor and find the same number in the browser address bar.<\/p><p class=\"wp-block-paragraph\">WordPress assigns a unique numeric ID to each post, page, and other content item. The dashboard is the quickest way to find one ID, while the page source works without dashboard access. Plugins are useful for checking multiple IDs, while WordPress functions and database access suit developer workflows.<\/p><p>\n\n\n\n<\/p><h2 id=\"h-how-to-find-wordpress-post-and-page-ids-manually\" class=\"wp-block-heading h-t-title-2\">How to find WordPress post and page IDs manually<\/h2><p class=\"wp-block-paragraph\">The quickest way to find a WordPress post or page ID is through its URL in the WordPress dashboard. If you don&rsquo;t have dashboard access, you can also check the source code of a public post or page.<\/p><h3 id=\"h-1-via-the-url-in-the-wordpress-dashboard\" class=\"wp-block-heading h-t-title-3\">Find the ID in the WordPress dashboard<\/h3><p class=\"wp-block-paragraph\">You can find a post or page ID by hovering over its title or opening it in the WordPress editor.<\/p><p class=\"wp-block-paragraph\">If you&rsquo;re new to managing content in WordPress, the <a data-click-id=\"hgr-post-content-link-wordpress-post-editor\" href=\"\/my\/tutorials\/how-to-add-a-new-post-in-wordpress\/\">WordPress post editor<\/a> is where you can create, edit, and organize posts before checking their IDs.<\/p><ol start=\"1\" class=\"wp-block-list\">\n<li>Go to <strong>Posts &rarr; All Posts<\/strong>. For a page ID, open <strong>Pages &rarr; All Pages<\/strong> instead.<\/li>\n\n\n\n<li>Hover over the post or page title.<\/li>\n\n\n\n<li>Look at the URL preview at the bottom of your browser. The number after <code>post=<\/code> is the post or page ID.<\/li>\n<\/ol><p class=\"wp-block-paragraph\">For example, if the URL contains <code>post=123<\/code>, the ID is <strong>123<\/strong>.<\/p><p class=\"wp-block-paragraph\">You can also click <strong>Edit<\/strong> to open the post or page. The editor URL in your browser&rsquo;s address bar contains the same <code>post=<\/code> parameter.<\/p><h3 class=\"wp-block-heading h-t-title-3\">Find the ID in the page source<\/h3><p class=\"wp-block-paragraph\">You can find the ID from a post or page&rsquo;s HTML source if you don&rsquo;t have access to its WordPress dashboard.<\/p><ol start=\"1\" class=\"wp-block-list\">\n<li>Open the published post or page in your browser.<\/li>\n\n\n\n<li>Right-click the page and select <strong>View Page Source<\/strong>.<\/li>\n\n\n\n<li>Search the source for <code>postid-<\/code> if you&rsquo;re viewing a post or <code>page-id-<\/code> if you&rsquo;re viewing a page.<\/li>\n\n\n\n<li>The number after the class name is the post or page ID. For example, <code>postid-123<\/code> indicates post ID <strong>123<\/strong>.<\/li>\n<\/ol><p class=\"wp-block-paragraph\">This method works when the WordPress theme outputs the standard body classes. If you can&rsquo;t find <code>postid-<\/code> or <code>page-id-<\/code> in the source, use another method in this guide.<\/p><h2 id=\"h-how-to-find-a-wordpress-post-id-or-page-id-with-a-plugin\" class=\"wp-block-heading h-t-title-2\">How to find WordPress post and page IDs with a plugin<\/h2><p class=\"wp-block-paragraph\">A WordPress plugin is useful if you regularly need to check IDs for multiple posts, pages, categories, or other content types. Instead of opening each item individually, the plugin displays IDs directly in the WordPress dashboard.<\/p><p class=\"wp-block-paragraph\">One option is <strong>Reveal IDs<\/strong>, which adds an ID column to supported WordPress admin screens.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-my-tutorials-wp-content-uploads-sites-2-2019-04-the-reveals\" href=\"\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/04\/The-Reveals-IDs-official-website-inside-the-22WordPress22-page.png\"><img decoding=\"async\" width=\"1024\" height=\"694\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/04\/The-Reveals-IDs-official-website-inside-the-22WordPress22-page.png\/w=1024,h=1024,fit=scale-down\" alt='The Reveals IDs official website, inside the \"WordPress\" page.' class=\"wp-image-57888\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/The-Reveals-IDs-official-website-inside-the-22WordPress22-page.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/The-Reveals-IDs-official-website-inside-the-22WordPress22-page-300x203.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/The-Reveals-IDs-official-website-inside-the-22WordPress22-page-150x102.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/The-Reveals-IDs-official-website-inside-the-22WordPress22-page-768x520.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p class=\"wp-block-paragraph\">To use it:<\/p><ol start=\"1\" class=\"wp-block-list\">\n<li><a data-click-id=\"hgr-post-content-link-install-the-wordpress-plugin\" href=\"\/my\/tutorials\/how-to-install-wordpress-plugins\/\">Install the WordPress plugin<\/a> and activate it.<\/li>\n\n\n\n<li>Go to <strong>Posts &rarr; All Posts<\/strong> or <strong>Pages &rarr; All Pages<\/strong>.<\/li>\n\n\n\n<li>Find the <strong>ID<\/strong> column next to each post or page.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-my-tutorials-wp-content-uploads-sites-2-2019-04-wordpress-po\" href=\"\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column.png\"><img decoding=\"async\" width=\"1720\" height=\"598\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column.png\/w=1024,h=1024,fit=scale-down\" alt=\"WordPress Posts screen, highlighting a post ID column.\" class=\"wp-image-57889\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column.png 1720w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column-300x104.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column-1024x356.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column-150x52.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column-768x267.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2019\/04\/WordPress-Posts-screen-highlighting-a-post-ID-column-1536x534.png 1536w\" sizes=\"(max-width: 1720px) 100vw, 1720px\" \/><\/a><\/figure><\/div><p class=\"wp-block-paragraph\">Reveal IDs also supports IDs for content such as categories, tags, custom post types, and taxonomies, making it more useful when you need to work with IDs regularly.<\/p><h2 id=\"h-how-to-find-wordpress-post-ids-and-page-ids-advanced-methods\" class=\"wp-block-heading h-t-title-2\">How to find WordPress post and page IDs with code<\/h2><p class=\"wp-block-paragraph\">Developers can retrieve WordPress post and page IDs using built-in WordPress functions or directly from the WordPress database. Use WordPress functions when working inside a theme or plugin, and check the database when you need to inspect stored content directly.<\/p><h3 class=\"wp-block-heading h-t-title-3\">Retrieve an ID with WordPress functions<\/h3><p class=\"wp-block-paragraph\">The <code><a data-click-id=\"hgr-post-content-link-get_the_id\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_the_id\/\" target=\"_blank\" rel=\"noopener\">get_the_ID()<\/a><\/code> function returns the ID of the current post or page inside the WordPress Loop:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$post_id = get_the_ID();<\/pre><p class=\"wp-block-paragraph\">To display the ID directly, use:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">echo get_the_ID();<\/pre><p class=\"wp-block-paragraph\">If you already know the post URL, <code><a data-click-id=\"hgr-post-content-link-url_to_postid\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/url_to_postid\/\" target=\"_blank\" rel=\"noopener\">url_to_postid()<\/a><\/code> can retrieve its ID:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$post_id = url_to_postid( 'https:\/\/example.com\/example-post\/' );<\/pre><p class=\"wp-block-paragraph\">You can also use <code><a data-click-id=\"hgr-post-content-link-get_page_by_path\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_page_by_path\/\" target=\"_blank\" rel=\"noopener\">get_page_by_path()<\/a><\/code> to retrieve a post or page by its slug:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$post = get_page_by_path( 'example-post', OBJECT, 'post' );\n\nif ( $post ) {\n    echo $post-&gt;ID;\n}<\/pre><h3 class=\"wp-block-heading h-t-title-3\">Find an ID in the WordPress database<\/h3><p class=\"wp-block-paragraph\">Post and page IDs are stored in the <code>ID<\/code> column of the WordPress posts table. This method is useful when you already have database access and need to inspect IDs directly.<\/p><ol start=\"1\" class=\"wp-block-list\">\n<li>Open phpMyAdmin from your hosting control panel.<\/li>\n\n\n\n<li>Select your site&rsquo;s <a data-click-id=\"hgr-post-content-link-wordpress-database\" href=\"\/my\/tutorials\/wordpress-database\/\">WordPress database<\/a>.<\/li>\n\n\n\n<li>Open the <code>wp_posts<\/code> table. Your table prefix may differ from <code>wp_<\/code>.<\/li>\n\n\n\n<li>Find the relevant post or page and check its <code>ID<\/code> column.<\/li>\n<\/ol><p class=\"wp-block-paragraph\">The <code>wp_posts<\/code> table also contains fields such as the post title, slug, status, and content type, which can help you identify the correct entry.<\/p><h2 class=\"wp-block-heading h-t-title-2\" id=\"h-what-can-you-do-with-a-wordpress-post-or-page-id\">What can you do with a WordPress post or page ID?<\/h2><p class=\"wp-block-paragraph\">Once you know a WordPress post or page ID, you can use it to target specific content in custom code, shortcodes, queries, plugins, or theme settings. For example, you might use an ID to include or exclude a particular post from a custom list or apply functionality only to one page.<\/p><p class=\"wp-block-paragraph\">If you need the ID for custom PHP, follow safe methods for <a data-click-id=\"hgr-post-content-link-adding-php-code-to-wordpress\" href=\"\/my\/tutorials\/how-to-add-php-code-to-wordpress\/\">adding PHP code to WordPress<\/a> rather than modifying WordPress core files. Back up your website before changing theme or plugin code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To find a WordPress post ID or page ID, go to Posts &rarr; All Posts or Pages &rarr; All Pages and hover over the title. In the URL preview, the number after post= is the post or page ID. You can also open the post or page in the editor and find the same number [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/my\/tutorials\/wordpress-post-id\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":258,"featured_media":71566,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Find WordPress Post ID and Page ID","rank_math_description":"Find a WordPress post ID or page ID using the dashboard, page source, a plugin, WordPress functions, or the database. Follow the right method for your needs.","rank_math_focus_keyword":"wordpress post id","_content_updated_date":"","footnotes":""},"categories":[22666],"tags":[],"class_list":["post-16808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/wordpress-post-id","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/post-id-wordpress\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/post-id-wordpress\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/wordpress-post-id","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/wordpress-post-id","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/wordpress-post-id","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/wordpress-post-id","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/wordpress-post-id","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/wordpress-post-id","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/wordpress-post-id","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/post-id-wordpress\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/16808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/258"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=16808"}],"version-history":[{"count":26,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/16808\/revisions"}],"predecessor-version":[{"id":138205,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/16808\/revisions\/138205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media\/71566"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=16808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=16808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=16808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}