Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wp_insert_post_data', 'initiate_sectionize', 99);
- function initiate_sectionize($data) {
- $processed_content = sectionize($data['post_content']);
- if(is_array($processed_content)) {
- $data['post_content'] = $processed_content[1];
- add_filter('redirect_post_location', 'sectionize_location_filter', 99);
- }
- else {
- $data['post_content'] = $processed_content;
- }
- return $data;
- }
- function sectionize_location_filter($location) {
- remove_filter('redirect_post_location', __FUNCTION__, 99);
- $location = add_query_arg('message', 99, $location);
- return $location;
- }
- add_filter('post_updated_messages', 'sectionize_messages_filter');
- function sectionize_messages_filter($messages) {
- $messages['post'][99] = 'Something went wrong';
- return $messages;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement