Most themes that I’ve seen use the post ID as the ID of the wrapping div for a post on the home page, archives, single post, etc. For example:
<div id="post-1920" class="post [...]">post content and meta</div>
So you could parse that with a regex or using something like Simple HTML DOM.
But again, this is theme-dependent. It may not work 100% of the time.
Also, on the single post page, if there is a comment form, there should be a hidden input with the name “comment_post_ID” that contains the post ID.
Related Posts:
- Need help with add_rewrite_rule
- Get current URL (permalink) without /page/{pagenum}/
- How to get pretty URLs with add_query_arg in permalinks
- How does wordpress keep track of post id when post id is not used in permalinks?
- Permalinks to Custom does not work (out of box)
- Multi-language permalink in qtranslate
- How to add query parameters to all internal links?
- How to make draft posts or posts in review accessible via full url / slug?
- nginx – permalinks with .php in url not working
- Social Media Links on homepage – within posts/post loop
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- How to change the link structure of the homepage?
- WordPress on VirtualBox – no pretty permalinks
- Remove words from permalink when saving post automatically?
- WordPress | Convert #038; to &
- How to add category to the permalink and breadcrumb?
- Rewrite my default post URL
- Get permalink to page?
- Parent Category link to its sub categories on different page
- How can I link a file in admin with a button?
- Remove Dash/Hyphen From WordPress CustomPosttype Permalink
- Auto-create a pretty permalink for a bunch of posts
- Permalinks: Page Not Found
- WordPress blog posts permalinks giving 404 on nginx
- how to add rewrite rule to wordpress default post type
- Only default permalink is working mod_rewrite enabled
- Is a permastruct possible on pages?
- Custom WordPress user permalink
- Custom Permalinks for Posts only
- Editing URL character replacement
- How to make /search/ without parameters not return a 404?
- Get post text (by its URL) from database dump
- Why wordpress kicks me back to the dashboard of xampp? [closed]
- WordPress archive permalink with leaf category
- Permalink shows garbage character
- Rewrite rule intended for CPTs gives 404 for pages
- Redirecting all posts after changing URL structure with htaccess
- Permalink redirection.
- All top-level pages are using index.php as template
- Redirect all posts permalinks from “.html” to “/”
- Nginx url rewrite rule problem
- Permalink options page corrupts web.config file
- How to rename ‘Tag Base’ with WPeC 3.8?
- Custom rewrite rule ignored
- Stop Images Linking to Themselves?
- Permalink Problems
- Make last three words of excerpt a link
- Resolve 404 on posts without category
- Permalink of a page that has already been deleted
- How to remove .html from admin
- Retrieve default permalink while using seo friendly URLs in WordPress
- Inserting a string in the middle of page’s permalink?
- When I click on a single post my browser goes to about:blank#blocked and the page is white
- WordPress Permalinks problem
- Pagination using paginate_links
- How to get rid of an extra middle part my permalink
- Access or edit custom generated permalinks with WP_Rewrite
- Add custom query vars to pretty permalinks
- How Can I Use a Custom AccessFileName?
- xammp server permalink by postname not working
- Redirect after permalink changes
- replacing post ID by custom post name in url
- Change type of permalinks on TinyMCE link dialogue
- Problem with special character WordPress
- Permalinks and page store
- All in One Seo and Permalinks
- Change pemalink for one single post without redirect
- Add .html permalink to post if specific category
- Strip subcategory base from URL
- rewrite based slug standar post wp
- How to update wordpress permalink structure with author role?
- How to turn a custom query string into permalink?
- How can i fix my permalinks?
- Edit Post Permalink option removed, looking for possible causes
- Site Tagline ended up in permalink
- Custom structure permalink preventing 404
- Add slug to default post permalinks ONLY
- Getting 400 Bad request Error when trying to open posts after updating to wordpress 5.0
- Category Base permalinks
- Propper way to set anchor and url param
- Pretty Filter URL
- Add URL to selected post in meta box
- How to change dynamic link to relevant post
- Auto-generated pretty permalink not using title since 4.4 update
- Problems with permalinks after update wordpress 4.2
- Add Custom Pagination Permalink
- Prevent guessing slug
- Pretty permalinks to work for lighttpd webserver?
- Pages included in another page and duplicate content issues for SEO
- Customize category permalinks
- Latin character conversion
- WordPress archive posts returns user to homepage
- broken permalinks in responsive layout
- URL to an image in a post is changing when permalink is set to custom. Can I avoid this?
- permalinks url with woocommerce
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- Blog url disappears
- Not recognizing my custom templates in hierarchy
- Change default URL (or permalinks) in the back-end
- How to put link on a slideshow gallery?