Admin::admin_action_new_post()
Admin action new post.
Description
When a new post action is fired the title is set to ‘Elementor’ and the post ID.
Fired by admin_action_elementor_new_post
action.
Changelog
Version | Description |
---|---|
1.9.0 | Introduced. |
Source
core/admin/admin.php
public function admin_action_new_post() { check_admin_referer( 'elementor_action_new_post' ); if ( empty( $_GET['post_type'] ) ) { $post_type = 'post'; } else { $post_type = $_GET['post_type']; } if ( ! User::is_current_user_can_edit_post_type( $post_type ) ) { return; } if ( empty( $_GET['template_type'] ) ) { $type = 'post'; } else { $type = $_GET['template_type']; // XSS ok. } $post_data = isset( $_GET['post_data'] ) ? $_GET['post_data'] : []; $meta = []; /** * Create new post meta data. * * Filters the meta data of any new post created. * * @since 2.0.0 * * @param array $meta Post meta data. */ $meta = apply_filters( 'elementor/admin/create_new_post/meta', $meta ); $post_data['post_type'] = $post_type; $document = Plugin::$instance->documents->create( $type, $post_data, $meta ); wp_redirect( $document->get_edit_url() ); die; }
Uses
- core/admin/admin.php: elementor/admin/create_new_post/meta
- includes/user.php: User::is_current_user_can_edit_post_type()