0

When I upload a new file I have this error message : Content, title, and excerpt are empty.

I found the error messahe in wordpress_data/wp-content/languages/en_GB.po line 6809 (but it's a post related file !)

The file is physcially uploaded, but it's not shown on media lits.

I have no hints in wp-content/debug.log :

define('WP_CACHE', false);
define('DISABLE_CACHE', true);
define('WP_REDIS_DISABLED', true);

I'm using WP 6.1.3 multsite on PHP 8

1 Answer 1

1

Line 4139 of post.php in WP 6.2 branch has the error message, Content, title, and excerpt are empty.. Reviewing the previous lines of code, it should be excluded for attachments, but there may be a callback applied to the wp_insert_post_empty_content filter which is requiring attachments to also have content, title, and excerpt.

Use Query Monitor or search your codebase for uses of the wp_insert_post_empty_content filter. If none are found, then you can use the second parameter of the filter to restore core functionality on the filter (untested):

add_filter( 'wp_insert_post_empty_content', static function ( $maybe_empty, $postarr ) {
    $post_type    = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type'];
    $post_title   = $postarr['post_title'];
    $post_content = $postarr['post_content'];
    $post_excerpt = $postarr['post_excerpt']; 

    return 'attachment' !== $post_type
        && ! $post_content && ! $post_title && ! $post_excerpt
        && post_type_supports( $post_type, 'editor' )
        && post_type_supports( $post_type, 'title' )
        && post_type_supports( $post_type, 'excerpt' );
}, 9999, 2 );
1
  • Thanks :) There was a plugin with wp_insert_post_empty_content hook ! I've removed it and it's ok.
    – Sami
    Commented Aug 2, 2023 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.