• Resolved cuhrig

    (@cuhrig)


    Hi there, I’m creating a custom plugin that was working just fine, nothing complicated, just a metabox with some fields and then attaching them to the save_post hook for accessing the data. Everything was working just fine, but when I updated to the latest WP version I can’t access the $_POST variable anymore, it always comes empty. I’ve tried without plugins, with core themes, downgrading WP core to 6.1.3 works just fine, the issue seems to be with 6.3.1

    
    
    add_action( 'add_meta_boxes', array( $this, 'add_custom_metaboxes' ) );
    add_action( 'save_post', array( $this, 'handle_section_clone' ) );
    
    
    
    /**
    * Add_custom_metaboxes
    *
    * @return void
    */
    public function add_custom_metaboxes() {
    
    add_meta_box( 'gwn-section-selector', 'Select Sections from other Courses', array( $this, 'section_selector_metabox_content' ), LP_COURSE_CPT, 'normal' );
    
    }
    
    /**
    	 * Sesson_selector_metabox_content
    	 *
    	 * @param  mixed $post Post object.
    	 * @return void
    	 */
    	public function section_selector_metabox_content( $post ) {
    
    		// Add the nonce field.
    		wp_nonce_field( 'gwn_section_selector_nonce_action', 'gwn_section_selector_nonce' );
    
    		// Require the template file.
    		require plugin_dir_path( __FILE__ ) . 'templates/clone-sections-metabox.php';
    	}
    
    
    	/**
    	 * Handle section clone.
    	 *
    	 * @param int      $post_id Post ID.
    	 */
    	public function handle_section_clone( $post_id ) {
    var_dump($_POST); exit;
    }
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Cant access $_POST superglobal after upgrading to 6.3.1’ is closed to new replies.