add_action( 'publish_post', 'run_when_post_published_first_time',10,2 );
function run_when_post_published_first_time($post_id, $post)
{
// Checks whether is post updated or published at first time.
if ($post->post_date != $post->post_modified) return;
// Place here your code
}
Related Posts:
- How do I append multiple taxonomies to the URL?
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Custom post types, taxonomies, and permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- Mixing custom post type and taxonomy rewrite structures?
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Custom Post type & Taxonomy URL structure
- Combining Multiple Taxonomies in one URL
- Permalink rewrite 404 conflict- WordPress Taxonomies/ CPT
- Help with a TV series Rewrite structure
- Custom Post Type with Nested Taxonomy and Template Files
- Custom permalinks – post type – hierarchical taxonomy’s
- Semantic URL Custom Post Type and Taxonomies permalinks
- Custom Taxonomy conditionals
- wp_insert_post custom taxonomy
- Page to display an archive of taxonomies
- How to create a permalink for custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to show custom taxonomy in the permalink?
- Date-based permalinks for Custom Post Type, and custom taxonomy permalinks
- Custom Taxonomy breaking pages permalinks
- Permalinks for custom post-types within custom taxonomies not found
- custom post type and custom taxonomy url conflict
- Add hierarchical taxonomy to permalink for custom post type
- Weird problem happening with custom taxonmy when creating/updating posts
- Parent & Child Taxonomy slugs in custom post permalink
- Custom Post Types and independent Categories – complex Taxonomy
- custom permalinks based on taxonomies for custom post type
- Custom taxonomy in URL showing 404
- Permalink structure by Post Meta value
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- How do I move/order posts with a tag to the end?
- WordPress sort search results by custom order
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- custom-taxonomy/post_name instead of the default post_type/post_name
- Show custom post archive when custom post not specified
- How to checked selected category checkbox when my custom post inserted from frontend
- How to start a new post with custom Taxonomies already set?
- Create a custom php page and load it at a specific slug
- Permalinks /country/city/cpt/postname/
- Seamless permalinks between Custom Taxonomy and Custom Posts
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- How to include term custom meta into the custom taxonomy term permalink structure
- Permalinks: custom post type -> custom taxonomy -> post
- How to change permalink to include custom post type
- Custom post type permalink tag 404
- Migrating a taxonomy’s tags to the native category
- set permalink for CPT
- custom post type vs. conditionally displaying meta boxes for specific terms?
- Template for custom post type when taxonomy is in the URL
- Permalink problems with custom post type and custom taxonomy
- Custom Post Type Advanced Slug
- Display Custom Post Types Glossary
- Ideas on how to organize a project [closed]
- How should I structure complex content hierarchies?
- Change permalinks for custom post type based on taxonomy term
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Custom post type category permalinks and archive pages
- Safe to throw 404 error in request filter?
- Multiple permalinks for a single post with multiple taxonomies
- WP 3.1 custom post type permlinks
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- How to prefix custom post type URL with custom post taxonomy term?
- How do you create pillar content pages?
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Changing permalink of default Post with custom post
- wp_insert_post deleting previous post custom meta
- Custom Taxonomy Archive generates 404
- Custom post type single with custom URL structure
- Customise Permalink Structure For Custom Post Types
- How to create a permalink structure with custom taxonomies and custom post types
- Pagination not working (page/2 retunring 404 page)
- Custom permalink with custom taxonomies for custom post type
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Change the url of a custom post type to include taxonomy
- Post Custom & Taxonomy 404 error
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Multiple archives for cpt, taxonomies, terms
- Same permalink structure for all post types?
- How to add base permalink to custom posts?
- WP_Query for CPT with filter by another WP_Query
- Hierarchical taxonomy in permalink structure
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- taxonomy term names in custom post type permalink structure
- Parent cpt/child custom post type URL permalink relationship
- Change Taxonomy Permalinks
- Category / Custom Post Type permalink issue
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- Remove slug from Custom Category Permalink + dual-category permalinks
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Add /blog to the “post” post type url
- Inserting two categories
- Advise on Custom Taxonomies and Structure