Yoast Duplicate Post

Error with Yoast Duplicate Post

You may have this kind of error with Yoast Duplicate Post :

An error of type E_ERROR was caused in line 311 of the file /wp-content/plugins/duplicate-post/src/ui/classic-editor.php. Error message: Uncaught ArgumentCountError: Too few arguments to function Yoast\WP\Duplicate_Post\UI\Classic_Editor::remove_slug_meta_box(), 1 passed in /wp-includes/class-wp-hook.php on line 303 and exactly 2 expected in /wp-content/plugins/duplicate-post/src/ui/classic-editor.php:311
Stack trace:
#0 /wp-includes/class-wp-hook.php(303): Yoast\WP\Duplicate_Post\UI\Classic_Editor->remove_slug_meta_box('calp_event_page...')
#1 /wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#2 /wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#3 /wp-content/plugins/calpress-event-calendar/app/helper/class-calp-settings-helper.php(426): do_action('add_meta_boxes', 'calp_event_page...')
#4 /wp-includes/class-wp-hook.php(303): Calp_Settings_Helper->add_meta_boxes('')

Or :

Fatal error: Uncaught Error: Class 'Yoast\WP\Duplicate_Post\Admin\Options_Page' not found in /wp-content/plugins/duplicate-post/options.php:15 Stack trace: 
#0 /wp-content/plugins/duplicate-post/admin-functions.php(15): require_once() 
#1 /wp-content/plugins/duplicate-post/duplicate-post.php(110): include_once('/home/dev1/publ...') 
#2 /wp-admin/includes/plugin.php(2288): include_once() 
#3 /wp-admin/plugins.php(192): plugin_sandbox_scrape() 
#4 {main} thrown in /wp-content/plugins/duplicate-post/options.php on line 15

Or :

PHP Fatal error:  Uncaught Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "Wpil_Model_Link" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /wp-includes/formatting.php:4934
Stack trace:
#0 /wp-includes/formatting.php(4929): map_deep(Object(__PHP_Incomplete_Class), 'duplicate_post_...')
#1 /wp-content/plugins/duplicate-post/admin-functions.php(423): map_deep(Array, 'duplicate_post_...')
#2 /wp-content/plugins/duplicate-post/admin-functions.php(447): duplicate_post_addslashes_deep(Array)
#3 /wp-content/plugins/duplicate-post/admin-functions.php(409): duplicate_post_wp_slash(Array)
#4 /wp-includes/class-wp-hook.php(305): duplicate_post_copy_post_meta_info(259119, Object(WP_Post))
#5 /wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#6 /wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#7 /wp-content/plugins/duplicate-post/admin-functions.php(744): do_action('dp_duplicate_po...', 259119, Object(WP_Post), 'draft')
#8 /wp-content/plugins/duplicate-post/src/handlers/link-handler.php(87): duplicate_post_create_duplicate(Object(WP_Post), 'draft')
#9 /wp-includes/class-wp-hook.php(303): Yoast\\WP\\Duplicate_Post\\Handlers\\Link_Handler->new_draft_link_action_handler('')
#10 /wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#11 /wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#12 /wp-admin/admin.php(408): do_action('admin_action_du...')

Or :

PHP Fatal error: Uncaught Error: Call to undefined method Composer\Autoload\ClassLoader::setClassMapAuthoritative() in /wp-content/plugins/duplicate-post/vendor/composer/autoload_real.php:41.

Or :

Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /wp-includes/taxonomy.php:2524 Stack trace: #0 /wp-includes/taxonomy.php(2524): array_diff(Array, Array) 
#1 /wp-content/plugins/duplicate-post/duplicate-post-admin.php(587): wp_set_object_terms(1124, Array, ‘job-location’) 
#2 /wp-includes/class-wp-hook.php(289): duplicate_post_copy_post_taxonomies(1124, Object(WP_Post)) 
#3 /wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) 
#4 /wp-includes/plugin.php(478): WP_Hook->do_action(Array) 
#5 /wp-content/plugins/duplicate-post/duplicate-post-admin.php(875): do_action(‘dp_duplicate_po…’, 1124, Object(WP_Post), ”) 
#6 /wp-content/plugins/duplicate-post/duplicate-post-admin.php(529): duplicate_post_create_duplicate(Object(WP_Post), ”) 
#7 /wp in /wp-includes/taxonomy.php on line 2524

Or :

PHP Fatal error: Uncaught OutOfBoundsException: Package “sentry/sentry” is not installed in /wp-content/plugins/duplicate-post/vendor/composer/InstalledVersions.php:188″
WARNING: [pool www] child 30196 said into stderr: “NOTICE: PHP message: PHP Fatal error: Uncaught OutOfBoundsException: Package “sentry/sentry” is not installed in /wp-content/plugins/duplicate-post/vendor/composer/InstalledVersions.php:188

There are multiple solutions to try to make it work.

Updates

The first thing to do if you are stuck with Yoast Duplicate Post is to ensure that all your WordPress is up to date. You should check your :

  • WordPress
  • Plugins
  • Theme

Once all these updates are done, check back if these errors appear.

Check Yoast Duplicate Post

Sometimes, you just need to disable the plugin, and enable it just after to make it work again.

If it doesn’t work, your Yoast Duplicate Post plugin may be corrupted. To ensure that it’s not your case, you have to re-download the plugin (or the theme delivered with the plugin) and try to install it again.

Check others plugins

Are you sure that the error is related to Yoast Duplicate Post? Maybe not.

It could be related to another plugin that is not compatible. It could happen when you use a cache plugin, a security plugin, or simply a poorly developed plugin.

Disable all plugins. Then, check for your error, if the error is still there, the problem is not related to plugins compatibility. If there are no more errors, then enable every plugin one by one and check for the error. The goal is to target the plugin involved.

Try another theme

The error can be a problem with your theme.

If it’s not already done, then you should install & activate the default WordPress theme like Twenty Twenty-Two. Check for the error, and see what is happening to be sure that your WordPress theme is not the cause.

Permalinks & htaccess

If it doesn’t work, you may have a problem with your WordPress permalinks and/or your htaccess file. You should go on your WordPress dashboard, and re-saving permalinks from the permalinks page.

Contact the developer

If all these solutions don’t work, we advise you to contact the plugin developer.

You may have found a new bug, or a specific issue. You should get in touch with the developer either on the WordPress plugin forum, either by mail, either on their specific website with their own support.

Alternative solutions

If the developer doesn’t reply, or your problem is very urgent, then you should try an alternative to the plugin.

There are thousands of plugins on the official directory, and many others outside. You should try to find and test them!

If the issue is very specific, and the plugin could not be replaced, we advise you to contact an expert.
This is the best way to ensure you're not going to break your site anymore.