Cuatom Post Types = Blank Page (3 posts)

  1. kevin_c
    Posted 5 years ago #

    Hi there,

    I've been trying to use the new Custom Post Types feature in WordPress. I have a strange problem though. Whenever I follow instructions on various tutorials*, as soon as I add the add_action function into functions.php the whole site and admin go blank. I've tried adding the code and the top and the bottom of functions.php but it's always the same result.

    I can add it to posts.php and it works fine and shows up fine in the admin, but that seems strange I can't add it into functions.php. I've a reasonable amount of experience with other CMSs, but less with WordPress, so perhaps there's something very small I'm missing. I've seem from comments on tutorials* that others are experiencing the same problem.

    I'm running a fresh install of WordPress 3, on MAMP on OSX, and I reinstalled WP (and database) from scratch to try eliminate anything unusual.

    Any suggestions? It all seems very strange.

    * http://thinkvitamin.com/dev/create-your-first-wordpress-custom-post-type/

  2. kevin_c
    Posted 5 years ago #

    Quick updated on this. I turned debug mode on for WordPress and now I'm getting a specific error message.

    I can't understand why this could be an issue in a fresh install. My googling reveals others with this problem so there must be something specific causing it.

    “Fatal error: Call to undefined function add_action() in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3″

    Would really appreciate any pointers from those more experienced in WordPress.


  3. kevin_c
    Posted 5 years ago #

    For anyone else having the same problem I figured it out.

    I was adding the code to the main wordpress functions.php when in fact it is supposed to go in the functions.php of the theme you're using.

Topic Closed

This topic has been closed to new replies.

About this Topic