Hi,
If you are reading this blog post after searching “Catchable fatal error: Argument 1 passed to Genesis_Admin_CPT_Archive_Settings ” in Google, it means you are in trouble. But don’t worry, I faced this situation just like you! You are not the first person facing this weird issue. Hundreds of people faced this Catchable fatal error and solved this problem with the solution I have given below. Don’t rush. Read the whole blog post first.
What’s The Problem
If you are using WordPress CMS for your website or blog and also using Genesis theme framework from Studiopress and if you have a latest WordPress version update available and you just update the WordPress version before you update the Genesis theme, you will get following error:
Catchable fatal error: Argument 1 passed to Genesis_Admin_CPT_Archive_Settings::__construct() must be an instance of stdClass, instance of WP_Post_Type given, called in /srv/www/genesis/htdocs/wp-content/themes/genesis/lib/admin/menu.php on line 122 and defined in /srv/www/genesis/htdocs/wp-content/themes/genesis/lib/admin/cpt-archive-settings.php on line 38
WordPress upgraded something in their version 4.6 that created a problem for your Genesis versions 2.3.0 and the following. A latest Genesis version was launched to solve this problem a couple of weeks earlier WordPress 4.6 was launched though. Anyway the thing is, if you upgrade WordPress version to 4.6 before upgrading Genesis you will have this problem.
It means, you can’t login to WordPress dashboard (/wp-admin). As a result you can’t publish a new post, manage users or update existing posts, comments or any plugins!
Geeky Details
I am not a coder nor a WordPress developer. Let’s check what WordPress Geeks are saying about this:
Until Genesis 2.3.1, the constructor for the Genesis_Admin_CPT_Archive_Settings was utilizing ‘type hinting’ for identifying the $post_type argument to be passed into the constructor as being of the class called stdClass.
Since WordPress 4.6, the stdClass to be applied for $post_type has been changed with a recently released class WP_Post_Type, it still acts the exact same way but doesn’t fit the predicted stdClass. This misfit created the PHP error.
I Faced It Too
I am using Generis framework from Studiopress and I updated my WordPress prior to updating Generis theme. As a result, I got “Catchable fatal error: Argument 1 passed to Genesis_Admin_CPT_Archive_Settings” just like you.
In this blog post I am going to share how to solve “Catchable fatal error: Argument 1 passed to Genesis_Admin_CPT_Archive_Settings“. After reading this blog post, please check video tutorial for further help. Hopefully your problem will be solved within 5 minutes.
Solution
We will show you how you can disable a small function of Genesis, the archive pages those are usually Custom Post Type, that will let you to upgrade to the new version of Genesis.
Step 1: Include These Lines of Code to the End of functions.php
Your developer or you should include these lines of code to the end of the functions.php file of the Genesis theme. It’s most probably situated at wp-content/themes/genesis/functions.php.
* Disable Genesis CPT Archives
*
* This is useful to temporarily disable the Genesis CPT Archives,
* if you can not log into your WordPress site
* after updating to WordPress 4.6.
*
* See
* http://salcode.com/wp46/
* for more information.
*/
add_filter( ‘genesis_cpt_archives_args’, ‘fe_modify_args_to_include_non_existant_name’ );
function fe_modify_args_to_include_non_existant_name( $args ) {
$args[‘name’] = ‘this-is-a-name-that-does-not-exist-resulting-in-no-matching-cpts’;
return $args;
}
Step 2: Save and Upload Modified Functions.php
Now you need to save functions.php file and refresh it. Then upload it to Genesis folder.
If it asks to overwrite please do so, I mean hit “OK” button 🙂
Step 3: Â Retry to login
If you were not logged out during the whole update process, you can refresh your browser window to check the change or you can try to re-login to /wp-admin.
Step 4: Upgrade to the New Version of Genesis
Problem solved!
You don’t need to remove the block of codes you added in Step 1 from functions.php file. If you want to remove then note, you might need to redo all the above steps if you accidentally update WordPress version prior to updating Genesis theme in the future.
Quick Suggestion
Always update Genesis before WordPress.
Thanks
Special thanks to Sal Ferrarello, whose blog post helped me to solve my issue 🙂
Watch this live tutorial and solve your problem in just 5 minutes:
Leave a Reply