Support » Plugin: Custom Sidebars - Dynamic Widget Area Manager » Undefined Index: Action on New Post (quick fix)

  • Resolved johnrom

    (@johnrom)



    When creating a new post (or on the dashboard home with a “quick draft”), there is no $_POST[‘action’]. The current condition checks if the index is set, but if it’s not continues to check the $_POST due to the order of operations.

    /inc/class-custom-sidebars-editor.php on line 663

    Current Condition:

    
    if ( ( 'editpost' != $action || ! isset( $_POST['action'] ) ) && 'inline-save' != $_POST['action'] ) {
    	return $post_id;
    }
    

    Should be something like:

    
    
    if ( ( 'editpost' != $action || ! isset( $_POST['action'] ) ) && ( ! isset( $_POST['action'] ) || 'inline-save' != $_POST['action'] ) ) {
    	return $post_id;
    }
    

    You could condense $action and $_POST[‘action’] into a new variable and check against that instead of checking if $_POST[‘action’] is set twice.

    • This topic was modified 2 years, 3 months ago by  johnrom.
    • This topic was modified 2 years, 3 months ago by  johnrom.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined Index: Action on New Post (quick fix)’ is closed to new replies.