May 2017
Beginner to intermediate
536 pages
14h 25m
English
First, we have to update the class constructor with the actions required for displaying meta boxes and saving meta box values, as shown in the following code:
class WPWAF_Content_Restrictions{ public function __construct(){ // Other actions add_action( 'add_meta_boxes', array($this, 'add_topic_restriction_box' )); add_action( 'save_post', array($this, 'save_topic_restrictions' )); } }
Earlier, we created a meta box to save the custom fields of the topics screen. Similarly, we display another meta box for content restrictions using the add_meta_boxes action. Consider the initialization of the meta box inside the add_topic_restriction_box function:
public function add_topic_restriction_box(){ ...Read now
Unlock full access