You should use save_post
like the following:
function modifyOnPost( $post_id ) {
$post = get_post($post_id);
//do stuff here before your post is created or updated
}
add_action( 'save_post', 'modifyOnPost' );
Read more here.
Update:
To give a deeper solution you could use wp_update_post( $post, $wp_error );
inside the modifyOnPost
block to manipulate your post data.
Related Posts:
- How to check if a user exists by a given id
- How to use the do_action () with parameter
- TinyMCE custom styles remove class when switching styles
- Add admin bar link to edit author
- Extending the site search to include a single custom field
- Notify users whenever a new post is published based on their preference
- How to include one class/instance without using global variables
- Modify search function in WordPress (TwentyTwelve)
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- syntax for remove_filter in parent theme with class
- Remove Header and Footer in iframe
- How to Acheive the custom woocommerce category template
- Can I remove the Rich Text box editor for a specific post?
- How to add CSS style sheet dynamically in wordpress
- How to update BuddyPress xprofile fields programmatically? [closed]
- Redirect if not logged in?
- How to set global variables in template page?
- A snippet after every image
- Programmatically set page template based on page ID
- Setting featured image with function, 1 part not working
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- wp_remote_post with ssl:// protocol
- Best way to programatically add “rel” attributes to page and post images
- Comments to only be seen by their author
- Remove function or filter
- options.php problem – data not saved
- Filtering posts by category name based on page’s slug
- adding custom classes for tables
- Load parent theme files before child theme functions.php
- How to include local menu based on page id?
- CSS for menu item added via functions.php
- Default Gallery Edit/Template Editable?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Override a theme function in a child theme?
- changing behaviour of get_search_form
- Make parent page only link to first subpage
- Include default functions and methods
- How to validate this deprecated function
- How can I modify all existing tags while keeping the urls themselves?
- Scripts not appending to element in AJAX call – why?
- Trigger a custom function when option are saved in admin area
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Functions.php – Cannot Modify Header Information SOLVED [closed]
- How would I add “edit profile” and “blog post” functions to front-end?
- shortcode help require
- How can I add a filter for specific categories on functions.php?
- Custom editor color palette colors are not appearing in the editor
- Set Taxonomy based on post status
- echo custom fields with AJAX
- Function filter breaking tag archive menus
- How to create a functions.php in child theme? [closed]
- wordpress get_post_meta give only first value
- Using multiple line variable inside a function?
- How to echo the value of an array element using a function via a shortcode
- Determine if, within a post, you are on page 2 or greater – WordPress documentation circular
- Wp-query Order By problem
- Compare meta key to current date in pre get post
- I can’t add CSS with functions.php
- Register_Sidebar overwriting itself and doesn’t exist in global $wp_registered_sidebars;
- Protect get_query_var from manual input in url
- widgets not working
- Shortcode to get featured image of specific id post
- wp_get_archives() output
- hook for dashboard show_user_profile
- Problem with WordPress output text (‘esc_html’ & ‘wp_richedit_pre’)
- Get slug of current category in functions.php
- Prevent wp_signon redirect on failed login for ajax login
- removing description tabs – single product page – breaks footer
- only update titles of single posts
- Post content overflows on my mobile phone
- OOP Switch statement with array as parameter
- How set a while with a function
- Shortcode to output category description by passing ID
- some profile informations like youtube link doesnt seem
- Help using ShortCodes to style whole chunks of the post
- How to modify or override a core function (wp_star_rating)
- Is there is a way to check daily first login?
- Printing medium sized image
- Filter posts on new page
- Sticky – Featured Image
- delete_user_meta for user in spesific group
- Pagination not working on my archive page for a custom post type
- WordPress Jquery+scripts enqueue issue
- Remove Featured Images from Posts Older Than a Certain Date
- Adding a jQuery rotator function
- How to pass a variable from a template page to the child theme functions.php
- Home/Static Page View for Visitors pages after that should be restricted
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- Can’t change excerpt length and more tag
- Adding result from PHP function into an input field
- Using array page name together with page id to deregister script
- Echo a div to header.php from functions.php
- Modifying Page-Links format
- how to handle multiple forloop?
- Changed functions.php file and now site is blank [closed]
- PHP error in shortcode [closed]
- Setcookie not setting cookies anywhere except admin
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories