Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
nicoladj77 opened this Issue · 3 comments

2 participants

@nicoladj77

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

@nicoladj77

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.

@nicoladj77

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 bainternet referenced this issue from a commit
@bainternet fixed issue #38 f7f8273
@bainternet
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.