You’ve probably arrived on this page because you updated to WordPress 4.6 and now all of the backend pages (those in /wp-admin
) are showing an error similar to the following.
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
The Problem
You’re using the Genesis Theme Framework on your WordPress website. WordPress updated something in version 4.6
that caused a problem with Genesis versions 2.3.0
and below. A new version of Genesis was released to fix this issue a few weeks before WordPress 4.6 was released. Unfortunately, if you update WordPress before updating Genesis you get this issue.
How to Fix It
We’re going to temporarily disable a small part of Genesis, the Custom Post Type archive pages, which will allow you to update to the latest version of Genesis.
Step 1: Add This Code to the Bottom of functions.php
You or your developer should add this code to the bottom of the functions.php
file of the Genesis theme. It is most likely located at wp-content/themes/genesis/functions.php
. If you’re unsure how to do this, see the How to Edit functions.php section on this page.
/**
* 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: Log into Your WordPress Site
Step 3: Update to the Latest Version of Genesis
Geeky Details
For those of you interested in the geeky details of this issue.
Prior to Genesis 2.3.1, the constructor for Genesis_Admin_CPT_Archive_Settings
was using type hinting to define the $post_type
argument being passed into the constructor as being of the class stdClass
.
As of WordPress 4.6, the stdClass
being used for $post_type
has been replaced with a newly introduced class WP_Post_Type
, which though it still behaves the same way does not match the expected stdClass
. This mismatch caused the PHP error.
Updates
Update 1: Now with 25% fewer steps!
Originally this post included a Step 4, which instructed you to remove the code added to functions.php
. Some of the friendly readers of this post pointed out this step was unnecessary since during the Genesis Update functions.php
gets overwritten and therefore the code is no longer there to be removed. Thanks to all those who pointed out my error.
Update 2: How to Edit functions.php
In the comments, I’ve received a lot of inquires about how to edit functions.php
. Unfortunately, this is beyond the scope of this post. Hopefully, these notes will put you on the right path.
- If you have cPanel on your server, How to Edit a File with cPanel
- Check with your website host and ask about
SFTP
(orFTP
) access. If you’re not sure who your website host is, you can use whoishostingthis.com
Great post. Thanks!
VERY helpful. You saved my bacon! Much gratitude your way!
Awesome article. Thank you.
Thanks so much. This article was very helpful and very awesome.
This helped me out of a tight spot this morning. Thanks!
It worked perfectly, thank you.
Hello, thank you for the post but I can’t seem to access /wp-content/themes/genesis/functions.php
It just shows a “Fatal error: Call to undefined function do_action() in /home3/tesswhit/public_html/wp-content/themes/genesis/lib/init.php on line 15”
Hi Lisa,
It sounds like you’re going to the file in your web browser, e.g. going to a link like http://example.com/wp-content/themes/genesis/functions.php
Instead, you need to access the code in
functions.php
. Generally, this is done via SFTP or through you host’s control panel.How is this done through Cpanel?
Hi Harry,
I’ve updated the post with some links on how to edit your functions.php file. I hope these help.
Lisa, you can also edit it in cpanel file manager, assuming you use cpanel
Quick and easy, you’re a Godsend. Thanks!
Great post. Thank you!
Many thanks! This was very helpful 🙂
Thanks, Sal. I had a mini heart attack when I saw that error today. You’re a life saver.
Thank you so so much :)))))
Thanks. I go on vacation and the first thing I do when I come back is break my own site. Your post was a life saver. Thank you!
Just one thing. I didn’t need to remove the code I added to the functions.php file. It seems it was removed automatically. At least it was gone when I went to remove it. I don’t completely understand why, but I guess the main thing is it’s gone.
Thanks Denise, I’ve updated this article to correct this error. I appreciate the feedback.
Thanks for the help!
Thanks for sharing this information! I am having additional issues. I tried to update the Genesis theme + WordPress and a Fatal error has come up, very similar to what you have mentioned, however, I can’t log in to my site now, as the error comes up. I can go to a new browser window and get to my site like a normal user, and it shows I am in fact logged in. I then try and enter the dashboard, and the error comes up. No matter what part of my site menu (dashboard, updates, customize, etc.), I cannot get to any part without the error. What do I need to do to be able to access the site from my admin side?
Hi Amanda,
It sounds like you still need to update Genesis to the latest version. I’ve added some links on how to update functions.php, I hope these are helpful.
Hi Sal
Thanks heaps, this allowed me to log in. However I had already updated Genesis prior to updating WordPress. If I remove that code which allowed me to log in I again can’t log in. Any ideas on what I can do to resolve that?
PS I checked again, sorry, the current Genesis theme is actually 2.2.7, however there are no updates visibly available subsequent to the one I did recently. Our active theme is Executive Pro, a child theme of Genesis, and it’s current version is 3.0.0
Further to previous two messages, once I ticked the “check for updates” box in Genesis theme settings, the 2.3.1 update instantly became available within WordPress. Problem solved and functions.php file also returned to default so I didn’t need to remove the added code. Thank you!
Thank for your help. It solves the problem.
ben heel blij met je 🙂
Done!
Thank you for the knowledge, helped out a great deal!
Great fix, Sal. Much appreciated.
it won’t even bring me to the dashboard because I automatically get the error after i log in so how do i install the genesis theme again?
Hi Claudia,
I’ve updated the post with some links on how to edit your functions.php file. I hope these help.
Awesome sauce! I had a client who didn’t take my advice and update her Genesis theme, of course she was in a panic, but your post had her back up & running in under a minute. THANK YOU!
Saved my bacon!
Still get this with genesis 2.3.1 on the admin menu page in executive pro & workstation pro themes
Notice: Trying to get property of non-object in wp-admin/nav-menus.php on line 818
Hi Brad,
This notice sounds unrelated to the Genesis 2.3.1 update. Generally, notices are not displayed on a live website. You might want to check out WordPress Debug Settings.
Best of luck.
Thanks for this tutorial 🙂
+5
LIFESAVER – Thank you SO much for posting 🙂
I received an email that my WP was automatically updated to 4.6 but I still can’t log into my account. without 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 /home2/tiamarie/public_html/wp-content/themes/genesis/lib/admin/menu.php on line 122 and defined in /home2/tiamarie/public_html/wp-content/themes/genesis/lib/admin/cpt-archive-settings.php on line 38
Hi Tia,
It sounds like you still need to update Genesis to 2.3.1. Hopefully, the steps outlined in this post will help.
Hero status unlocked. Thank you.
Tried your fix
Now I get this
Parse error: syntax error, unexpected ‘}’ in /home/boule039/public_html/wp-content/themes/executive-pro/functions.php on line 20
Hi Nomran,
It sounds like you have an extra closing brace ‘}’ in your
functions.php
file. I’m guessing it got accidentally included when you were adding the code from this post.Hi,
Thank you! It worked – one question though, When I went back into my FTP and opened the file to delete the extra code, it was already gone. Is this normal?
Hi Luis,
You are absolutely correct, this was an error in my original post. I’ve updated this article to correct this error. I appreciate the feedback.
Much obliged. Was going to investigate but searched first on a whim. Perfect!
Great, you made my day!!!
Thanks a lot.
Saved my life, thanks for posting this easy fix!
Hi,
Thank you so much for this article. I did copy that code to my Genesis functions.php file, but I’m still getting the error message.
I even just manually uploaded Genesis 2.3.1 via ftp, but still no luck.
Thanks again!
Ted
Hi Ted,
I would double-check and make sure the error message you’re getting is the same one described in this post.
I would also consider disabling all plugins as a testing step.
Best of luck.
Thank you! I was stressed when I tried to login to my site and got this error. All fixed.
Very helpful. Thanks Sal
Thank you!
I thought we got hacked for a moment. Very grateful.
Awesome work! That’s saved me a mini heart attack and lots of frustration
Hi! Great article! I accidentally forgot to update Genesis before updating WP. So I’m receiving the error and can’t login. How do I “Add This Code to the Bottom of functions.php” if I can’t access the WP login?
Hi Harry,
I’ve updated the post with some links on how to edit your functions.php file. I hope these help.
THANK YOU!!!!
Sal, You are wonderful, thank you! You just saved me a heck of a lot of time. xoxo
Great advice, worked easy and perfect. Thank you very much. I highly appreciate your articles.
Thanks this saved me!
Thanks for your very helpful post. As a newbie to website building with WordPress, I found it was easier for my hosting service to make the changes because I was afraid of doing more damage.
I have a newbie question – do I make the upgrades to WordPress and Genesis as soon as they appear on the Dashboard? Is there a sequence – Genesis first, then WordPress?
Thanks again.
Hi Paula,
I’m glad to hear you got things sorted.
There are a lot of conflicting opinions on the proper order to update WordPress components. Personally, I update them in this order.
Thanks Sal, you made that so easy.
Yey!
OMG! This saved me. Thanks so much!
Question, should we go into the genesis function again after we update and remove the code we added in?
Thanks!!!
Hi Breanne,
You don’t need to remove the code, since the
functions.php
file gets overwritten on update. (Though I didn’t realize this initially and I had to update this post)I got the memo to update Genesis before WordPress 4.6 (thank you Lindsey @prettydarncute), but one of my clients didn’t. Your fix was a lifesaver, and made me look REALLY smart!!!
Thanks!
Thank you! Just came in very handy! (Client hadn’t logged in for a long time and therefore didn’t update Genesis, WP automatically updated, and…)
Thanks so much for this post as it really helped me out tremendously. Bless you.
Thanks so much! This was just the fix I needed.
Thanks! Super helpful.
HUGE thank you!
Thank you! This post saved the day. And maybe this issue will nudge the client to letting me do the updates as part of a maintenance contract. So hard to convince older clients that not maintaining their site is going to break things or worse…so thanks again!
🙂 More thanks
Thank you!
UGH, THANK YOU. I was on the verge of a mini panic attack.
thanks you save my day 🙂
This post is a lifesaver! Thanks so much!!
Thanks for this! Quickly got me back in and Saved me tons of time.
Saved my day, man.
This was a life-saver! Thank you! Not only did I fix my problem, but I learned some new things in the process! So helpful!
Thank you, thank you, thank you! Life saver :).
Thank you so much! I was having this problem on a couple of sites and your solution cleared it right up for me. I really appreciate you posting this …
I knew I was going to need this, and this morning I finally did. An old client emailed me in a panic. Thanks for the nice, quick fix.
Thanks, you’re a life-saver.
Thank you! Saved me from pulling out what little hair I have!
Thanks for this info and code. Saved me hours of work on a client site.
Thanks for the great article! I’m late to the party here, but you saved me too.
HELP please!! I looked for the functions.php file and I don’t see it. I followed the path wp-content/themes/genesis/ and then there two directories: images and lib. I opened lib and there is a functions directory but no functions.php file. Is there another way to fix this?? Or can I modify another file to get the same fix? These are the files inside the functions directory: breadcrumb.php, compat.php, deprecated.php, feed.php, formatting.php, general.php, image.php, layout.php, markup.php, menu.php, options.php, seo.php, upgrade.php and widgetize.php.
I looked inside all the directories and I cannot find it.
Thanks in advance!!
Found it!! Thank you so much for sharing your knowledge and information.
Thanks Sal! It’s always great to search Google for a problem and instantly find someone with a well-written fix!
You’re a lifesaver – such as well written post too.
Thanks!
awesome!
Thank you very much, such a simple solution and now I am back in the Admin section. Perfect!
This worked beautifully, thank you so much!!!
thank you!
Hi!
I just tried your solution different times, but still can’t log in to my dashboard, instead I get this error code:
“Warning: Cannot modify header information – headers already sent by (output started at /homepages/6/d507915940/htdocs/clickandbuilds/WordPress/Photoliebe/wp-content/themes/genesis/functions.php:449) in /homepages/6/d507915940/htdocs/clickandbuilds/WordPress/Photoliebe/wp-includes/pluggable.php on line 1174”
Do you have any tips what I could do? Also, the code I added to the function.php is now shown on the top of my website 🙁
What did I do wrong?
Hi Linda,
It sounds like the code you added is being treated as raw text rather than as PHP code. This happens most often when the code is not inside
<?php
and?>
.My guess is your
functions.php
file had a closing PHP tag (?>
) at the end of it and when you added the code from this article to the end of the file, it is outside the PHP block and treated like text.This is concerning to me because generally the Genesis
functions.php
does not have a closing PHP tag (?>
) because you don’t need one because PHP automatically closes the block at the end of the file.This is another guess but I suspect there is custom code in your
functions.php
, which will be overwritten when you update Genesis. If I’m correct about the custom code infunctions.php
, you’ll want to make a copy of the file on your local machine before updating.In any case, as a next step I’d try deleting the last closing PHP tag (
?>
) that appears infunctions.php
. Best of luck.I recently made the mistake of updating WordPress and then Genesis afterwards.
Subsequently, my category and tag pages are now blank to the white screen of death. I can log in to my control panel, and my regular pages and posts are visible, but I can’t fix the category and tag pages.
Would inserting your code in the Genesis functions.php file correct the problem with the category and tag pages?
Hi Glenn, it looks like you’re running Genesis
2.2.7
, while the latest is2.4.2
. Since you’re able to log in to the backend of WordPress, you shouldn’t need the fix in the this post. I’d start with updating Genesis and go from there.I made a HUGE mistake today and updated my new WordPress with updating Genesis first. I can not log into my wp-admin to even try and correct. I just continue to get this error when I log in…
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 /home/hh96466679/public_html/wp-content/themes/genesis/lib/admin/menu.php on line 122 and defined in /home/hh96466679/public_html/wp-content/themes/genesis/lib/admin/cpt-archive-settings.php on line 38
What can I do to try and UNDO this horrible error?
Hi Tracy,
Near the top of this page there is a section called How to Fix It with three steps listed. These are the three steps I use when I’m correcting this problem. I hope this helps.
Thank you for this information. However, I am unable to log into my wp admin to attempt any corrections. Is there a recommended way to be able to log in to my account to attempt this fix?
Hi Tracy,
Please check out the How to Edit functions.php section above. I can see how this section is not immediately obvious and I’ve now added a link to it within the Step 1 description. Best of luck.
thanks
Sal – Well DONE!
Thank you
So this worked, but the site was messed up after the upgrade…. I had to restore from backup
This is the first I’ve heard of something like this. I’ll definitely keep me eye out for anything like this. If you have any more information (e.g. screenshots of the site looking broken, the versions of WP & Genesis you had, etc.), I’d be interested to hear more about it.
i tried step 1 and i still can’t login to my site 🙁 any tips?
Hi Diane,
Assuming you are talking about your site linked here in the comments, stylecontext.com, it looks like you are running the latest version of Genesis at the time of my writing this (
2.4.2
), so it looks like a different issue preventing you from logging in. Sorry I don’t have more helpful information.Thank you!!
I added the code to the bottom of the file and got this error: Parse error: syntax error, unexpected ‘add_filter’ (T_STRING), expecting function (T_FUNCTION)
Hi Wally,
It sounds like some of the code that appears before the new code you added accidentally got modified.
This should be the line directly before the code you added.
My initial guess is the semi-colon (
;
) at the end of this line is missing.Hi Sal,
Thanks for this useful information. I’ve done it, but when I login I get this message:
“You don’t have permissions to access this page”.
My context is:
– I have a wp multisite with genesis.
– Today I’ve updated to wp 4.7.1 (did not know I had to update Genesis first …).
– The consequences have been two type of errors when accessing to wp:
(1) 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 /homepages/6/d316790346/htdocs/wp/wp-content/themes/genesis/lib/admin/menu.php on line 122 and defined in /homepages/6/d316790346/htdocs/wp/wp-content/themes/genesis/lib/admin/cpt-archive-settings.php on line 38
(2) “You don’t have permissions to access this page”.
Googleing for “Catchable fatal error: Argument 1 passed to Genesis_Admin_CPT_Archive_Settings” I’ve found your post, and I’ve made the change in functions.php file.
But, can’t access the admin panel, where I could do the next step you suggested to update Genesis. Still get the message: “You don’t have permissions to access this page”
Any suggestion?
Many thanks in advance!
Regards,
Jordi
Hi Jordi,
If the website you provided in your comment is the relevant website, it looks like your upgrade to Genesis 2.4.2 is complete (I’m basing this on the information at
/wp-content/themes/genesis/style.css
on your site).I suspect the “You don’t have permissions to access this page” error is unrelated to Genesis but this is just a guess. While it is rather technical, there is some information on this WordPress stackexchange article Troubleshooting a “You do not have sufficient permissions to access this page” error. Good luck, I know troubleshooting errors is not a lot of fun.
Thanks! Worked like a charm. Again able to access the backend and edit our website.
Thank you for sharing…been very helpful on many sites!
Thank you! I’m not a programmer and get nervous changing PHP files directly, but I had to do something! Your instructions worked perfectly! THANK YOU!
You are amazing. Thank you so much. FTP freaks me out, so being able to do it through CPanel was wonderful. 🙂
Your instructions worked perfectly, thank you SO much!! You really know your stuff when you can explain how to fix things easy enough for a non-technical people. 🙂
Thanks a lot. a great help.
InfiniteThanks!!
Thank you very much! Very grateful!
Hi Sal,
I did everything you said and it worked!
I just have this new problem: there’s now a “secondary sidebar widget” which I can’t get rid off. The visitors of the site luckily can’t see it, however, they will see some space at the websites right side. This space (and the secondary sidebar) appeared after I updated WordPress and after I put the coding under functions.php. Do you perhaps know why this happened and what I can do to fix this?
Hi Zeryab,
It sounds like your Genesis Layout Settings got modified. I would check the Default Layout under the Genesis Theme Settings (
/wp-admin/admin.php?page=genesis
).You’re a lifesaver! Thanks!!
This worked beautifully for a new client’s old website we couldn’t log into to make changes & run updates.
Thank you 1000 times, you save me <3
Thank you! Just what I needed!