Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action('rest_insert_attachment', function($attachment, $request, $creating) {
- $data = $request->get_params(); // Extra data that was sent to /wp/v2/media
- // In this example we can use $data['entry_id']
- // Something like: update_post_meta((int) $data['entry_id'], 'attachment_id', $attachment['ID']);
- });
Add Comment
Please, Sign In to add comment