Support » Fixing WordPress » Fatal error for function: get_post_format ()

  • I just installed WordPress using Dreamhost one-click advanced install.

    I deleted my example comment, but my example post is still published.

    When I load my site:

    I get this error message:

    Fatal error: Call to undefined function get_post_format() in […]wp-content/themes/twentyten/loop.php on line 60

    Here’s line 60 of loop.php:

    <?php if ( in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) || 'gallery' == get_post_format( $post->ID ) ) : ?>

Viewing 14 replies - 1 through 14 (of 14 total)
  • I just had the same problem today until I edited the hello world post. Now it seems to be working.

    The post format is a new feature that is being introduced in WordPress 3.1. Are you sure you didn’t accidentally install the 3.1 version of TwentyTen with the 3.0.1 version of WordPress?

    I am using a brand new one click install of 3.0.2 on DreamHost. It comes with the theme Twenty Ten 1.3-wpcom by the WordPress team already installed.

    You can see from the Codex link I posted that the get_post_format() function is part of WP 3.1. I just searched the 3.0.2 source code (including the bundled TwentyTen code), and that function is not defined or called anywhere. I don’t know why there would be a call to get_post_format() in your theme unless some 3.1 files were accidentally mixed in with the 3.0.2 install script. You should report this problem to DreamHost.

    As further confirmation, I just downloaded the WP 3.1 Beta 1 that was released on November 25. The following code does indeed appear on line 60 of loop.php in the TwentyTen theme (as reported by jkeegan). This is beta code, and there is no way it should be coming down as part of the one-click install on DreamHost. This problem should be reported to them ASAP.

    <?php if ( in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) || 'gallery' == get_post_format( $post->ID ) ) : ?>

    Thank you, I have informed DreamHost of this situation.

    Do you have any idea if this could be affecting network sites that were created as sub-directories? I can create them, but none of them work. They all have a “Not Found” “Apologies, but the page you requested could not be found. Perhaps searching will help.”

    My .htaccess file has only what the installer instructions said to put there, which is:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    I really don’t know, but if code from two different versions of WordPress is being mixed together, there could be all sorts of unpredictable side effects. Let DreamHost fix that problem first, then you can address the network problem as a separate issue.

    Thanks for your help ambosite. I had the exact same problem on yahoo with the same 3.0.2 version of wordpress using the same TwentTen theme. That’s why I am trying DreamHost now, and yes I am seeing unpredictable side effects.

    For example:
    When I use the default permalinks, my network sub-directory site displays exactly the same as my main site. If I switch my permalinks to ‘Day and Name’ then my network sub-directory site will not display, and instead I get the error message “Not Found” “Apologies, but the page you requested could not be found. Perhaps searching will help.”

    FYI, the “upgrade” to 3.0.2 that came out yesterday or last night (for me at least) seems to have fixed this problem. Thanks for all the helpful info @ambrosite!

    I am having the same problem that jkeegan and jknap968 have reported. I checked to see if I had the newest version on the dreamhost panel, and it is indeed 3.0.2 so the fix that you seem to have found jkeegan hasn’t applied to my account:

    I tried deleting the hello world post and adding a new sample one but that didn’t solve anything.

    If any of you have suggestions/solutions, please let me know.
    In the meantime, I also will inform dreamhost of the problem.

    @maxedleson after I was notified of the upgrade by Dreamhost, I had to login to my wordpress install and complete the upgrade through the WP automatic upgrade function. Did you complete this process as well? I still saw the error after Dreamhost posted that WP was upgraded, but once I completed the upgrade process inside WP, the blog rendered and the fatal error went away.

    @jkeegan … I’m not sure how to get to what you’re talking about….
    when you say “inside WP”… I assume you mean logging into sitename/wp-admin/ … but then I can’t find any options anywhere that have to do with upgrading….
    could you please clarify, thank you so much.

    @maxedleson you assume correctly, it was a yellow alert bar/ribbon at the top of my dashboard that said “upgrade available!” or something similar. With a button, and then it went to a status screen showing the steps in the upgrade. That was pretty much it, hope that helps!

    My guess is, running the upgrade from inside WordPress caused the 3.0.2 files to be pulled from the repository. That is why it fixed your problem, because the WP repository is configured correctly, and the upgrade overwrote the beta files you had installed from DreamHost.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Fatal error for function: get_post_format ()’ is closed to new replies.