user3528954
user3528954

Reputation: 867

Set feature image not working

On my blog when I add some functions for some hooks in functions.php then set feature image not work properly. When I upload the images it says

"An error occurred in the upload. Please try again later"

error page

My added function code to functions.php file

add_action('transition_post_status', 'send_new_post', 10, 3);

// Listen for publishing of a new post
function send_new_post($new_status, $old_status, $post) {
  if('publish' === $new_status && 'publish' !== $old_status) { 
        $post_id = $post->ID;
        echo "<script>postId = console.log(".$post_id.")</script>";
  }
}

When I remove this function from functions.php file set feature image start working properly.

Upvotes: 0

Views: 108

Answers (1)

user3528954
user3528954

Reputation: 867

It's working after giving writable permission to wp-content/uploads folder

Upvotes: 1

Related Questions