Critical Error Message and Duplicating Posts
-
I love the Yoast Duplicate Post plugin and have been using it for a while now. But when I try to use it now, I immediately get an error message stating “There has been a critical error on this website. Please check your site admin email inbox for instructions. If you continue to have problems, please try the support forums.” There is no email in my admin inbox with instructions, and if I go back into my posts, there are now two posts with two different URLs instead of merging the two and creating a draft post.
The page I need help with: [log in to see the link]
-
Hi @thomask0702
Thanks for reaching out, and sorry you’re running into this. A few things that’d help us figure out what’s going on:
Which button are you clicking? Just to make sure we’re looking at the right thing — Rewrite & Republish, right? (Not Clone or New Draft?)
Could you share the underlying error message? WordPress hides the details on that screen, but we can capture them with a small change to your config:
- Add this to wp-config.php (above the /* That’s all, stop editing! */ line):
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false ); - Try the republish again so the error gets recorded.
- Open /wp-content/debug.log and paste the error and stack trace here — that’ll tell us exactly where it’s failing.
A bit about your setup
- Yoast Duplicate Post version
- WordPress version
- PHP version (Tools → Site Health → Info → Server)
- Active theme
- Other active plugins — page builders (Elementor, Divi, Beaver Builder), ACF, or multilingual plugins (WPML, Polylang) are especially worth flagging if you’re using
any.
On the two posts you’re seeing. Normally Rewrite & Republish merges your changes back into the original and tidies up the copy on its own. If something errored out partway through, the copy can end up as a regular published post. Before deleting anything, it’s worth comparing the two: if the original already has all your latest changes, you can safely delete the copy. If your edits only made it into the copy, you’ll want to port them over to the original (or keep the copy and delete the original instead) so you don’t lose your work.
Once we have a look at the error log and your setup, we should be able to track down what’s tripping it up. Thanks!
Hi, thanks for getting back with me so fast!
I’m clicking on rewrite & republish. I’ve used it many times over the past couple of years and I love it and it usually works great for me.
I don’t trust myself not to mess something up by adding that to my wp-config file, so I’ve copied the error part of the email I got. It took them a while to finally send me the email. Here is that:
Error Details
=============
An error of type E_ERROR was caused in line 78 of the file /home/nginx/domains/letthemeatgfcake.com/public/wp-content/plugins/duplicate-post/src/handlers/handler.php. Error message: Uncaught Error: Class “Yoast\WP\Duplicate_Post\Handlers\Rest_API_Handler” not found in /home/nginx/domains/letthemeatgfcake.com/public/wp-content/plugins/duplicate-post/src/handlers/handler.php:78
Stack trace:
#0 /home/nginx/domains/letthemeatgfcake.com/public/wp-content/plugins/duplicate-post/src/duplicate-post.php(72): Yoast\WP\Duplicate_Post\Handlers\Handler->__construct()
#1 /home/nginx/domains/letthemeatgfcake.com/public/wp-content/plugins/duplicate-post/duplicate-post.php(71): Yoast\WP\Duplicate_Post\Duplicate_Post->__construct()
#2 /home/nginx/domains/letthemeatgfcake.com/public/wp-includes/class-wp-hook.php(341): __duplicate_post_main()
#3 /home/nginx/domains/letthemeatgfcake.com/public/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#4 /home/nginx/domains/letthemeatgfcake.com/public/wp-includes/plugin.php(522): WP_Hook->do_action()
#5 /home/nginx/domains/letthemeatgfcake.com/public/wp-settings.php(593): do_action()
#6 /home/nginx/domains/letthemeatgfcake.com/public/wp-config.php(90): require_once(‘…’)
#7 /home/nginx/domains/letthemeatgfcake.com/public/wp-load.php(50): require_once(‘…’)
#8 /home/nginx/domains/letthemeatgfcake.com/public/wp-admin/admin.php(35): require_once(‘…’)
#9 /home/nginx/domains/letthemeatgfcake.com/public/wp-admin/edit.php(10): require_once(‘…’)
#10 {main}
thrownMy Yoast duplicate post version is 4.6, WordPress version is 6.9.4, Php version 8.3.8, Active theme is Foodie Pro 5 on the Genesis framework, and my other active plugins are: Akismet, Bigscoots Cache, Broken link checker, Enable media replace, Feast plugin, Featured images in RSS for Mailchimp & more, Imagify, Mailchimp for WordPress, Raptive ads, Raptive affiliate, Site kit by google, Slickstream search & engagement, WP recipe maker premium, WP rocket, WP rollback, Yoast SEO, and Yoast SEO premium.
Thanks again! Kim
Hi @thomask0702 ,
thanks, that stack trace is exactly what we needed!The error is that PHP can’t load the Rest_API_Handler class, even though it’s a file that ships with version 4.6 (/wp-content/plugins/duplicate-post/src/handlers/rest-api-handler.php). That points to your installed copy of the plugin being incomplete — most likely an interrupted or partial update where handler.php got the new code but rest-api-handler.php didn’t make it onto the server (or the opcode cache is still serving an older version of one of them).
A clean reinstall should sort it out:
- Go to Plugins, deactivate Yoast Duplicate Post.
- Delete it. (Your settings are stored in the database, so you won’t lose them.)
- Install it fresh from Plugins → Add New, then activate it.
- If your host has a “Clear PHP / OPcache” option (or a button in Bigscoots), give it a click afterwards just to be safe. That should put a complete, matching set of plugin files back on disk. Once it’s done, try Rewrite & Republish on a test post and let us know if the error is gone.
For the two posts left over from earlier: before deleting either, compare them side by side. If your latest edits are on the original, the copy is safe to delete. If your edits only made it onto the copy, you’ll want to move them over to the original first (or keep the copy and delete the original) so you don’t lose any work.
Thanks!
I wish I could say it worked, but I’m still getting the same message. I had done a fresh reinstall prior to contacting you the first time, but never cleared the OPcache so I tried that this time and I’m still getting that same error message. Do you think I should put a support ticket into Bigscoots and see if they can figure out why it’s not working?
Hi @thomask0702 , sorry to hear that…
Are you able to navigate the plugin folder via e.g. FTP to check whether thesrc/handlers/rest-api-handler.phpis there?
I think it’s worth asking Bigscoots support in case something is happening on their side about caching or so…
Please let us know about any findings!The problem has been fixed! BigScoots found that there was some leftover data in the database from an old plugin that was causing some issues. The plugin name was Link Whisper Free. They fixed the issue and things are back to working again! Thank you for all your help 🙂
Hey @thomask0702, great to hear this! Thanks for reporting back!
- Add this to wp-config.php (above the /* That’s all, stop editing! */ line):
You must be logged in to reply to this topic.