attachments - 500 internal error at wp_generate_attachment_metadata

I found that my PHP script throws an 500 (Internal Server Error) at the line which wp_generate_attachment_metadata funct

I found that my PHP script throws an 500 (Internal Server Error) at the line which wp_generate_attachment_metadata function is used:

$attach_data = wp_generate_attachment_metadata( $attach_id, $fullpathfilename );

I can exit and take an output before this line but not after that.

I checked the inputs too:

Array
(
    [attach_id] => 101362
    [fullpathfilename] => /home/appleapp/USER/wp-content/uploads/2014/05/Beat-the-Boss-2-17+945428.png
)

Any help is really appreciated.

I found that my PHP script throws an 500 (Internal Server Error) at the line which wp_generate_attachment_metadata function is used:

$attach_data = wp_generate_attachment_metadata( $attach_id, $fullpathfilename );

I can exit and take an output before this line but not after that.

I checked the inputs too:

Array
(
    [attach_id] => 101362
    [fullpathfilename] => /home/appleapp/USER/wp-content/uploads/2014/05/Beat-the-Boss-2-17+945428.png
)

Any help is really appreciated.

Share Improve this question asked May 3, 2014 at 6:54 revorevo 6475 silver badges19 bronze badges 2
  • Have you check this [wordpress/support/topic/… ? – Wit Wikky Commented May 3, 2014 at 7:04
  • @Rorschach yes, differs from mine. – revo Commented May 3, 2014 at 7:06
Add a comment  | 

2 Answers 2

Reset to default 1

You might need to require once this file:

wp-admin/includes/image.php 

wp_generate_attachment_metadata() should be used in conjunction with wp_update_attachment_metadata(). So your code should look something like this. (quote from the codex).

To generate attachment metadata for attachment with parent post ID 37:

<?php
  $attach_id = wp_insert_attachment( $attachment, $filename, 37 );
  $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
  wp_update_attachment_metadata( $attach_id,  $attach_data );
?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745086908a4610461.html

相关推荐

  • attachments - 500 internal error at wp_generate_attachment_metadata

    I found that my PHP script throws an 500 (Internal Server Error) at the line which wp_generate_attachment_metadata funct

    15小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信