“best” greatly depends on context.
guid is probably (with some debate about it) the best way to uniquely identify a post, but not all import/export plugins leave it alone without changes.
ID is a good identifier if you do not care about import and export.
Slug is problematic because they might be changed by the user.
The best thing to do if you need to know which post you should treat in a special way is to have an admin configuration for it that saves its ID. Then when you need to work with the same code in different environments you can just change the configuration without changing the code.
Related Posts:
- How to remove Nextpage tag inside posts text depending of utm_campaign
- Get post slug and match with menu item slug to change css
- retrieve post slug by post_tags taxonomy
- Get page ID of page that is set as the posts page
- Stop WordPress Wrapping Images In A “P” Tag
- Stop WordPress automatically adding tags to post content
- Where is the old post permalink slug stored?
- Get content from one page and show it on another page
- Use category base slug in posts’ permalink
- Are post ID’s reliable?
- Get current post id in functions.php
- WordPress removing tags?
- Custom Post Types, slug, archive and SEO plugins
- get all posts ID from a category
- Add tag to post api wordpress
- Set tags for a post – without tag creation
- Strategy for handling hierarchical pages with empty parent content
- How to automatically generate a unique random slug
- Post slugs and images cannot have same name?
- Get the current post ID as a variable in Javascript
- Is post ID number always incremental n+
- Change the Slug of Post Type post to baseurl/post/%postname%
- Verify if tag is used on posts
- Plain-text tag list?
- How can you make sure authors’ posts are longer than 250 words?
- Display posts by tag on page
- How to control which category will be picked for the slug of a post?
- Edit a post from frontend. post_tags get saved, but not separated
- Change slug with custom field
- What is the best / efficient way to get WordPress content by post id and why?
- Convert IPTC keywords to blog post tags
- JSON not valid after json_encode posts
- Determining Slug Before and After Edit
- Are all ID’s used unique?
- Add default content to post (for specific category)
- $post->ID displays wrong ID
- how to limit and display tag?
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Programmatically inserting page breaks
- How to update all post at once?
- Hide parts of the post content on the home page
- Filter/Remove HTML Elements on all posts and pages
- Paragraphs removed when using get_post_custom()?
- Include related posts on a page
- Load post content into div with ajax
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- How to display post tags
- How to add shortcode tags in single.php [closed]
- get post id in while loops outputting page id
- How can I display a specific user’s first published post?
- Remove post_tag from default post type, add custom taxonomy
- Undefined variable post_id in custom quick edit coloumn
- generate unique slug while inserting post
- How do I get the slug of a custom taxonomy category of a post?
- What Defines What Category A Post Picks (if in multiple)
- Testing for post title in ‘if/else’ statement returns no content
- Same content shared between multiple posts?
- Does an action fire when adding a tag via the “Tags” meta box?
- how load content as pop-up using ajax
- how to programmatically change post tags
- Getting post id from wp_insert_post_data function?
- How to get posts by multiple post slugs? [duplicate]
- Does an article (post) id ever change?
- Define a name to the posts slug
- Filter Posts By Tag
- How to get the post’s parent ID?
- Can a page_id and a post_id be same?
- WordPress post tag & custom field
- How to get only text from wordpress post content?
- WP Query related posts by current page Tag ID
- How to display all posts assigned to some tag?
- Is there a better, more efficient way to get the post id outside the loop?
- How To Add One Tag to Multiple Posts?
- Add Post Tags to Body Class
- Getting current post ID in functions.php
- How to prevent WordPress from updating the modified time?
- Batch process: remove first image from post content
- Buddypress activity id
- Bulk update post slugs through database
- WP Query – duplicated posts once including tags in search results
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Tags to Post-ID mysql query. Tag Search
- How to add Tags Filter in wordpress admin dashboard
- How blog page in WordPress works : blog page retrieve first post ID
- Prepend or add an Image to the content of a Post
- Display post from current category and same tag?
- Why content_arr[‘extended’] removes paragraph tags?
- Post-ID in url differs from $post->ID
- Why is my Blog Page ID == First Post ID?
- Unautop / Sanitize content added to a post through a plugin
- is there a way to show the the post title after the image?
- How to get rid of shortcodes in post content once and for all
- Should I use posts or pages in this scenario?
- Display posts with tag that matches current post title
- How can I make a post that belongs to a category or have specific tags, display different from the other single posts?
- Add Word Limit to Posts
- current post with current author
- Using permalinks, category slugs, and tag slugs
- “more” tag doesn’t appear when browsing category achives or search