Title: Fatal error when viewing custom post type
Last modified: August 20, 2016

---

# Fatal error when viewing custom post type

 *  [madbird](https://wordpress.org/support/users/madbird/)
 * (@madbird)
 * [14 years ago](https://wordpress.org/support/topic/fatal-error-when-viewing-custom-post-type/)
 * I have created a custom post type, when I attempt to view the post I get the 
   following message:
 * _“**Fatal error**: Cannot use object of type WP\_Error as array in /home/madrid7/
   public\_html/birdwatching-in-madrid/wp-includes/functions.php on line 3291″_
 * I have searched and this seems to be a common problem yet I can not find a solution–
   why do I start?
 * EXAMPLE:
    [http://madridbirder.com/birdwatching-in-madrid/species/test-species-post-type/](http://madridbirder.com/birdwatching-in-madrid/species/test-species-post-type/)

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

 *  [michael.mariart](https://wordpress.org/support/users/michaelmariart/)
 * (@michaelmariart)
 * [14 years ago](https://wordpress.org/support/topic/fatal-error-when-viewing-custom-post-type/#post-2776510)
 * This error means that your custom post type is trying to call some WordPress 
   core function, but is either not doing it the right way, or it’s giving it osme
   ort of invalid data and is returning an error.
 * To see what the problem is. try this code:
 * > echo “
   >     ```
   >     ";
   >     var_export ($my_var_name);
   >     echo "
   >     ```
   > 
   > “;
 * What this will do is tell you what the actual error that you are getting is, 
   and that will let you go and fix it.
 * It is hard to know where to place it though. If you turn on debug mode in your
   wp-config.php file you will probably see a lot more detail on where the error
   is in your code and that should help you find where this needs to go.
 *  Thread Starter [madbird](https://wordpress.org/support/users/madbird/)
 * (@madbird)
 * [14 years ago](https://wordpress.org/support/topic/fatal-error-when-viewing-custom-post-type/#post-2776768)
 * Thx Michael but is there another way of fixing this – I have no idea how to use
   the code above!
 *  [michael.mariart](https://wordpress.org/support/users/michaelmariart/)
 * (@michaelmariart)
 * [14 years ago](https://wordpress.org/support/topic/fatal-error-when-viewing-custom-post-type/#post-2776773)
 * There’s a lot of ways that you can do it, but in the end it all comes down to
   being just you taking steps to debug your own code. That is something that you
   will have to learn – because you will always get issues like this.

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

The topic ‘Fatal error when viewing custom post type’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)
 * [wp_error](https://wordpress.org/support/topic-tag/wp_error/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [michael.mariart](https://wordpress.org/support/users/michaelmariart/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/fatal-error-when-viewing-custom-post-type/#post-2776773)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
