LLMS_Meta_Box_Course_Options::save_before( int $post_id )
Update course difficulty on save
Parameters Parameters
- $post_id
-
(int) (Required) WP Post ID of the course
Return Return
(void)
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.course.options.php
protected function save_before( $post_id ) {
if ( ! isset( $_REQUEST['lifterlms_meta_nonce'] ) ) {
return;
}
if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['lifterlms_meta_nonce'] ) ), 'lifterlms_save_data' ) ) {
return;
}
if ( ! function_exists( 'register_block_type' ) || ! llms_blocks_is_post_migrated( $this->post->ID ) ) {
wp_set_object_terms( $post_id, llms_filter_input_sanitize_string( INPUT_POST, '_llms_post_course_difficulty' ), 'course_difficulty', false );
unset( $_POST['_llms_post_course_difficulty'] ); // Don't save this to the postmeta table.
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.9.0 | Stop using deprecated FILTER_SANITIZE_STRING. |
| 3.35.0 | Verify nonces and sanitize $_POST data. |
| 3.26.3 | Only save when using the classic editor. |
| 3.0.0 | Introduced. |