-3

以下のコードで T_Return 構文エラーが発生します。何かアイデアはありますか?

function wp_support_create_feature( $post ) {
  if ( defined('DOING_AUTOSAVE' && DOING_AUTOSAVE )
    return $post;

  if ( has_post_thumbnail( $post ) )
    return $post

  $first = get_children( array(
            'post_parent'    => $post->ID,
            'post_type'      => 'attachment',
            'post_mime_type' => 'image',
            'posts_per_page' => (int)1,
        ), ARRAY_A
   );
  set_post_thumbnail( $post->ID, $first[0]['ID'] );
}
add_action( 'save_post', 'wp_support_create_feature' );
4

2 に答える 2

2
function wp_support_create_feature( $post ) {
   if ( defined('DOING_AUTOSAVE' && DOING_AUTOSAVE )) // closing parens
   return $post;

   if ( has_post_thumbnail( $post ) )
   return $post; // semi-colon

$first = get_children( array(
        'post_parent'    => $post->ID,
        'post_type'      => 'attachment',
        'post_mime_type' => 'image',
        'posts_per_page' => (int)1,
    ), ARRAY_A
);
set_post_thumbnail( $post->ID, $first[0]['ID'] );

} add_action( 'save_post', 'wp_support_create_feature' );
于 2013-02-11T17:33:46.213 に答える