Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Issue with "Quick Edit" of category when an image field is added to the category pages #38

Closed
nicoladj77 opened this Issue Oct 16, 2012 · 3 comments

Comments

Projects
None yet
2 participants

I've added an image field to the categories for a custom post type. The only error i keep getting is that if i choose to quick edit a category and then i press "Update category" the server responds with the following html

 Are you sure you want to do this?</p><p><a href='http://localhost/wordpress/wp-admin/edit-tags.php?taxonomy=events_categories&#038;post_type=ai1ec_event'>Please try again.</a>

while normally it should simply save the category and return the html for the categories

Ok the error is caused by the fact that save() is triggered when saving with quick_edit. This call triggers check_admin_referer() which since no nonce is present triggers wp_nonce_ays() which triggers the warning.

I've added

  /**
   * Save Data from Metabox
   *
   * @param string $term_id 
   * @since 1.0
   * @access public 
   */
  public function save( $term_id ) {
    // check if the nonce field is set, if not we are coming from quick edit and check_admin_referer() will have a strange behaviour
    if( basename( $_SERVER['SCRIPT_NAME'] ) === 'admin-ajax.php' && ! isset( $_REQUEST['tax_meta_class_nonce'] ) ) {
        return $term_id;
    }

Because i needed a quick fix. But there must be a better way.

bainternet added a commit that referenced this issue Oct 16, 2012

Owner

bainternet commented Oct 16, 2012

Thanks Nicola its fixed in the latest version 1.9.3
simply checking for term update Ajax action which is 'inline-save-tax'

thanks.

@bainternet bainternet closed this Oct 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment