Title: Error on edit page
Last modified: June 30, 2022

---

# Error on edit page

 *  Resolved [Li-An](https://wordpress.org/support/users/li-an/)
 * (@li-an)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/)
 * Hello, with last version 5.8.0.1 (and probabably with 5.8, I did not test), I
   cannot edit my posts. I’ve got an “unexpected error” showing. I must stick to
   5.7.3
    -  This topic was modified 3 years, 11 months ago by [Li-An](https://wordpress.org/support/users/li-an/).

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787528)
 * Hi,
 * which version of WordPress do you have please?
 * Which theme are you using?
 * Thx
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787637)
 * OK we have identified the issue.
 * Can you test on your site by replacing the code of this file (wp-seopress/assets/
   js/build/primary-category-select.js) by the one below please?
 *     ```
       import { __ } from '@wordpress/i18n'
       import { Component } from '@wordpress/element'
       import { withSelect } from '@wordpress/data';
       import { PanelRow, SelectControl } from '@wordpress/components'
   
       class TermSelect extends Component {
           constructor() {
               super(...arguments);
               this.onChange = this.onChange.bind(this);
               this.updateMetabox = this.updateMetabox.bind(this);
               this.state = {
                   primaryTermId: 'none',
                   selectableTerms: [],
               }
           }
   
           componentDidMount() {
               const primaryTermId = this.props.primaryTermId || 'none';
               this.setState({ primaryTermId });
               this.metaboxField = document.querySelector('#seopress_robots_primary_cat');
               if (this.metaboxField) {
                   this.metaboxField.addEventListener('change', e => {
                       this.setState({ primaryTermId: e.target.value });
                   });
               }
           }
   
           componentDidUpdate(prevProps, prevState) {
               // If available terms or selected terms have changed, check state.
               if (prevProps.allTerms !== this.props.allTerms || prevProps.selectedTermIds !== this.props.selectedTermIds) {
                   const selectableTerms = this.props.allTerms.filter(term => this.props.selectedTermIds.includes(term.id));
                   const primaryTermId = !this.props.selectedTermIds.length || !this.props.selectedTermIds.includes(parseInt(this.state.primaryTermId)) ? 'none' : this.state.primaryTermId;
                   this.setState({ selectableTerms, primaryTermId });
               }
               if (prevState.primaryTermId !== this.state.primaryTermId || prevState.selectableTerms !== this.state.selectableTerms) {
                   this.updateMetabox(this.state.primaryTermId);
               }
           }
   
           updateMetabox(selectedTermId) {
               if (this.metaboxField) {
                   const options = this.getOptions().map(option => {
                       const selected = option.value == selectedTermId ? 'selected="selected"' : '';
                       return <code><option value=&quot;${option.value}&quot; ${selected}>${option.label}</option></code>;
                   });
                   this.metaboxField.value = selectedTermId;
                   this.metaboxField.innerHTML = options.join('');
               }
           }
   
           getOptions() {
               return [
                   { value: 'none', label: __('None (will disable this feature)', 'wp-seopress') },
                   ...this.state.selectableTerms.map((term) => ({ value: term.id, label: term.name, }))
               ];
           }
   
           onChange(termId) {
               this.setState({ primaryTermId: termId });
           }
   
           render() {
               return !!this.state.selectableTerms.length && (
                   <SelectControl
                       label={__('Select a primary category', 'wp-seopress')}
                       value={this.state.primaryTermId}
                       options={this.getOptions()}
                       onChange={this.onChange}
                   />
               );
           }
       }
   
       const PrimaryTermSelect = withSelect((select, { slug }) => {
           const taxonomy = select('core').getTaxonomy(slug);
           const selectedTermIds = taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [];
           const allTerms = select('core').getEntityRecords('taxonomy', slug, { per_page: -1 })
           const primaryTermId = select('core/editor').getEditedPostAttribute('meta')['_seopress_robots_primary_cat'] || 'none';
           return { taxonomy, allTerms, primaryTermId, selectedTermIds }
       })(TermSelect);
   
       wp.hooks.addFilter(
           'editor.PostTaxonomyType',
           'wpseopress',
           (PostTaxonomies) => (props) => {
               return (
                   <>
                       <PostTaxonomies {...props} />
                       {props.slug && 'category' === props.slug &&
                           <PanelRow className="seopress-primary-term-picker">
                               <PrimaryTermSelect {...props} />
                           </PanelRow>
                       }
                   </>
               );
           }
       )
       ```
   
 * Thank you for your help!
 *  Thread Starter [Li-An](https://wordpress.org/support/users/li-an/)
 * (@li-an)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787673)
 * I’m on WP 5.9.1. I tried the code but it seems it does not change anything for
   me. Theme is Blocksy.
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787688)
 * Make sure to clear your browser cache.
 *  Thread Starter [Li-An](https://wordpress.org/support/users/li-an/)
 * (@li-an)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787717)
 * OK, cleaning the cache seems to make the deal.
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787726)
 * Perfect! Patch incoming soon.
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15787814)
 * Version 5.8.0.2 is now available, please update.
 * Thank you!
 *  Thread Starter [Li-An](https://wordpress.org/support/users/li-an/)
 * (@li-an)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15788553)
 * Still broken in 5.8.0.2 for me 🙁
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15789007)
 * [@li-an](https://wordpress.org/support/users/li-an/) have you clear again you
   cache? Can you confirm you’re using SEOPress version 5.8.0.2?
 * Do you use Classic Editor or Gutenberg?
    Do you have enabled Universal SEO metabox
   from SEO, Advanced, Appearance tab?
    -  This reply was modified 3 years, 11 months ago by [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/).
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15789039)
 * It seems the problem is only present with WP versions < 6.0.
 * Still investigating.
 *  Thread Starter [Li-An](https://wordpress.org/support/users/li-an/)
 * (@li-an)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/#post-15789243)
 * SEOPress 5.8.0.2
    Gutenberg Universal Box not activated
    -  This reply was modified 3 years, 11 months ago by [Li-An](https://wordpress.org/support/users/li-an/).
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/page/2/#post-15797651)
 * [@li-an](https://wordpress.org/support/users/li-an/) do you still have the issue
   with version **5.8.0.3** (not 5.8.0.2)?
 * Thx
 *  Thread Starter [Li-An](https://wordpress.org/support/users/li-an/)
 * (@li-an)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/page/2/#post-15797667)
 * It seems solved with 5.8.0.3. Thanks.
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/page/2/#post-15797681)
 * Perfect!

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Error on edit page’ is closed to new replies.

 * ![](https://ps.w.org/wp-seopress/assets/icon-128x128.gif?rev=3158903)
 * [SEOPress - AI SEO Plugin & On-site SEO](https://wordpress.org/plugins/wp-seopress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-seopress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-seopress/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-seopress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-seopress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-seopress/reviews/)

 * 14 replies
 * 4 participants
 * Last reply from: [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/error-on-edit-page-2/page/2/#post-15797681)
 * Status: resolved