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 and independent Categories – complex Taxonomy
- Change Permalink Structure for Tag.php template
- Use different taxonomies in different custom post types’ permalinks?
- custom permalinks based on taxonomies for custom post type
- Custom template won’t load for a custom post type (custom permalinks used)
- Custom taxonomy in URL showing 404
- Custom Post Type permalink shows wrong page: homepage/index.php
- Permalink structure by Post Meta value
- How to hook custom taxonomies to custom post types and make the permalinks work?
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- List custom taxonomy specific to one custom post type
- Custom post type url with category
- How do I move/order posts with a tag to the end?
- Adding custom post category slug in permalink causes 404 error for pages and posts
- WordPress sort search results by custom order
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Hide parent categories when clicked, and show it’s childs
- custom-taxonomy/post_name instead of the default post_type/post_name
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Can’t remove front from permalinks for custom taxonomy category page
- How to checked selected category checkbox when my custom post inserted from frontend
- Removing custom post type slug from URL
- How to start a new post with custom Taxonomies already set?
- Customize Custom Post Type URL
- 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
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to have this permalink structure: post_type/postname/custom_inner_page
- How to include term custom meta into the custom taxonomy term permalink structure
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Permalinks: custom post type -> custom taxonomy -> post
- CPT’s with landing page instead of archive – Url Rewrite?
- How to change permalink to include custom post type
- How to add attributes to taxonomies that may be different from post to post?
- Custom post type, permalinks, taxonomies and blog posts
- Custom post type permalink tag 404
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- permalink /category/post-name with custom post type and taxonomy
- Custom post type and taxonomy permalinks
- Hierarchical permalinks for custom post type and taxonomy
- Migrating a taxonomy’s tags to the native category
- set permalink for CPT
- How to produce a sub-page-system in WordPress
- Custom permalink with child taxonomy terms
- Custom post type Permalinks with hierarchical Taxonomies
- Why cant I add a custom post type to a custom taxonomy?
- How to solve this custom post type goes to 404 page?
- Best way to specify “article type” in URL
- custom post type vs. conditionally displaying meta boxes for specific terms?
- Template files for Custom Post Type and Taxonomy
- Can’t use pagination with custom taxonomy
- List Categories (wp_terms) and count posts
- attach CPT data to a taxonomy
- 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
- Creating a non-hierarchical Taxonomy that behaves like categories
- How to filter a custom post type by custom taxonomy without 404
- How to get all posts related to particular category name on button click?
- Display Custom Post Types Glossary
- WordPress custom permalink and archive link for custom post type
- Ideas on how to organize a project [closed]
- How should I structure complex content hierarchies?
- Enabling permalinks disables custom page template
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Change permalinks for custom post type based on taxonomy term
- Get terms for a specfic post from multiple taxonomies in custom post type
- Using page title as a link to term archive
- How to list posts by term (custom taxonomy)
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Custom post type category permalinks and archive pages
- Custom category URL not displaying posts
- Safe to throw 404 error in request filter?
- Custom taxonomy not saving correctly
- Multiple permalinks for a single post with multiple taxonomies
- Related “custom post type” using “custom taxonomy”
- WP 3.1 custom post type permlinks
- How do I ensure that post_type and Taxonomy use the same slug?
- How do I disable the built-in editor and automatically configure the properties of new pages?
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Duplicate slug/permalink issue while adding same post name
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Set priority to permalinks
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Error 404 change permalink term custom term taxonomy
- 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?