You generally use add_filter
before displaying information. For your case you can use add_action('publish_post', 'your_function')
and then you intercept $_POST
values. The content of the WYSIWYG editor is available through $_POST['content']
.
The hook is of type publish_{post_type}
btw. You should change accordingly.
Example:
function wpse_89292_save_my_post()
{
print_r( $_POST['content'] ); # will display contents of the default wysiwyg editor
die;
}
add_action('publish_post', 'wpse_89292_save_my_post');
Using wp_insert_post_data
filter:
function wpse_89292_save_my_post( $content ) {
global $post;
if( isset($post) && get_post_type( $post->ID ) == 'post' ){
$content['post_content'] = function_to_manipulate_the_content();
}
return $content;
}
add_filter( 'wp_insert_post_data', 'wpse_89292_save_my_posts' );
Related Posts:
- Difference Between Filter and Action Hooks?
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How do I Make a Theme “plugin-ready”?
- Actions or filters fired when data is saved in a custom table
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Is it possible to create an action hook using do_action() within add_action()?
- Hook for post permalink update
- Dynamically Override Fancy Title
- Define a function outside a class and call the function using action or filter hook
- Synchronize Custom post type tags to WordPress default posts tags
- Woocommerce – Hide a Column in Cart Table
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- WordPress after content Hook & external template part
- Namespaced action and filter tags
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- WordPress custom taxonomy check box to dropdown
- How to get all queries’s results after they have executed?
- Remove an action by extending class and replacing it
- hook filter after the_content on a specific page
- Bind a function with its own argument to show something dynamically after every content
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Update variable value via add_filter
- Configure WordPress to Generate Scheme-less Relative URLs
- How to find list of all functions bind to a particular hook from my plugin?
- apply_filters() and call_user_func() to define and call a function outside a class
- Limit get_next_post to posts from the same author
- Any way, hook to add content right before the “read more” link?
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- Add_action not calling callback function
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- How to filter get_adjacent_post()?
- How do I replace title with my plugin?
- Apply function on all action hooks?
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Ninja Forms: Front-End Forms, Post ID?
- Post meta vs separate database tables
- How to create an API for my plugin?
- Update Option Stored in Multi-Dimensional Array
- How Can I Add a Filter to Class Instance Only?
- Does WP fire delete_post when trashed posts are automatically deleted?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- function triggered by “manage_users_custom_column” filter not working
- add_filter and remove_filter added before and after wp_query
- Some nav-menu filters do nothing
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Filter on the_content ignores shortcodes
- How to change wordpress post title?
- Get returned variable from a function to add_shortcode function
- How to add custom content under plugin row in WordPress admin plugin list?
- Database for development
- Is there a naming convention for database tables created by a plugin?
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- comment_email hook doesn’t seem to work for comment editor field
- unable to stop loop when using wp_insert_post with publish_post hook
- WordPress Ajax callback function from plugin – OOP
- Subscribe to author?
- Modifying meta tags after doing ajax call in plugin
- How To Change Logout Screen Title
- Where to add hooks in a class
- How to use output buffering in WordPress hooked functions?
- Check for template part, else filter content
- Adding option to Gallery shortcode
- Replace youtube embed in wordpress
- How can I replace content in the WP Admin area before an admin page is rendered?
- How to filter content for specific content variable
- Valid filenames for add_action’s first parameter
- How do I access the menus produced by Dashboard > Appearance > Menus
- How dynamic action login_form_{action} is working
- dbDelta not installing database
- What happens when two or more plugins use the same hook?
- How to get the post excerpt using post object?
- Adding columns to core tables
- Using AND and bracket grouping in SQL not working
- Ajax +wordpress onClick link redirect to new page and create html content
- How to replace settings in WordPress plugin from a theme
- Save temporary registration data
- Adding filter to the title without affecting the menu title
- How to validate inputs with filter in register_setting callback
- Can I attach a plugin via my add_filter callback contents?
- Creating posts with links from a txt file
- Why User_login key doesn’t work with wp_update_user()
- Is there any way to get post meta from publish_post hook?
- Plugin Development – Call to undefined function comment_exists()
- WordPress doesn’t create table on plugin activation
- Insert Data into Database
- login_message filter not working
- Update database record in plugin
- get_comment_meta() for a filter hook in a plugin
- Custom signature appears twice on page
- Does WordPress have something like timer hook?
- Can I use a hook other than ‘init’ to handle form submissions?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Woocommerce: block user removing cart item
- multiple record insert creating many duplicate records