0

I found this plugin very useful ajaxed-status It was created for post and page, and I want to apply it on media library. so I commented out the line if (is_admin() /*&& ($pagenow=='edit.php' )*/) and added this:

add_filter ( "manage_upload_columns", array ($this, 'add_new_columns' ) );
add_action ( "manage_media_custom_column", array ($this, 'manage_columns' ), 0, 2 );

Then, I got the status column on Media Library list page, and I can click the status to make it change to new status. But, the change can't be saved. From Firebug, I can see the ajax response is correct. I hope the original author, @Bainternet , or other people, may help figure this out.


update

I tried update_post_meta to save the $status as meta. It works. Just can't save it as post_status by wp_update_post.

4
  • I'll take alook as soon as i get home
    – Bainternet
    Commented Jun 17, 2012 at 16:32
  • 1
    I guess it has to do with the fact that attachments are set post_status inherited.
    – Bainternet
    Commented Jun 19, 2012 at 13:10
  • I guess the same. Maybe wp_update_post updates attachments differently. Anything might be bad if I update status in post table directly?
    – Jenny
    Commented Jun 19, 2012 at 13:40
  • @Bainternet , I changed the scripts that created the toggle links, I use $status as an argument of the function and added "inherit" as one of the switch cases.
    – Jenny
    Commented Jun 19, 2012 at 14:13

1 Answer 1

2

I think I find the answer-- wp-include/post.php:

if ( ! in_array( $post_status, array( 'inherit', 'private' ) ) )
    $post_status = 'inherit';

So, whatever status will be saved as "inherit".

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.