wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
_wp_delete_edit_root_attachment_id is private and should not be used in themes or plugins directly.
_wp_delete_edit_root_attachment_id › WordPress Function
Desde7.2.0
Obsoleton/a
› _wp_delete_edit_root_attachment_id ( $post_id )
| Acesso: |
|
| Parâmetros: |
|
| Definido em: |
|
| Codex: |
Clears the recorded edit root ID from any attachment pointing at a deleted one.
Without this, attachments created by editing the deleted image would keep pointing at an ID that no longer exists, and could later point at an unrelated attachment if WordPress reuses that ID. This only runs when an attachment is deleted for good. On sites where media goes to the trash first, attachments keep pointing at the trashed edit root until the trash is emptied.Fonte
function _wp_delete_edit_root_attachment_id( $post_id ) {
$post_id = (int) $post_id;
if ( $post_id <= 0 ) {
return;
}
/*
* Deletes the meta from every attachment recording this ID as its edit root. The meta key
* is indexed, so this only scans the rows for attachments created by editing an image,
* and it avoids searching the serialized attachment metadata for the ID.
*/
delete_metadata( 'post', 0, '_wp_attachment_edit_root_id', $post_id, true );
}