|
@@ 1521-1545 (lines=25) @@
|
| 1518 |
|
* @return (boolean) |
| 1519 |
|
*/ |
| 1520 |
|
|
| 1521 |
|
function acf_trash_field( $selector = 0 ) { |
| 1522 |
|
|
| 1523 |
|
// disable JSON to avoid conflicts between DB and JSON |
| 1524 |
|
acf_disable_local(); |
| 1525 |
|
|
| 1526 |
|
|
| 1527 |
|
// load the origional field gorup |
| 1528 |
|
$field = acf_get_field( $selector ); |
| 1529 |
|
|
| 1530 |
|
|
| 1531 |
|
// bail early if field did not load correctly |
| 1532 |
|
if( empty($field) ) return false; |
| 1533 |
|
|
| 1534 |
|
|
| 1535 |
|
// delete field |
| 1536 |
|
wp_trash_post( $field['ID'] ); |
| 1537 |
|
|
| 1538 |
|
|
| 1539 |
|
// action for 3rd party customisation |
| 1540 |
|
do_action( 'acf/trash_field', $field ); |
| 1541 |
|
|
| 1542 |
|
|
| 1543 |
|
// return |
| 1544 |
|
return true; |
| 1545 |
|
} |
| 1546 |
|
|
| 1547 |
|
|
| 1548 |
|
/* |
|
@@ 1561-1585 (lines=25) @@
|
| 1558 |
|
* @return (boolean) |
| 1559 |
|
*/ |
| 1560 |
|
|
| 1561 |
|
function acf_untrash_field( $selector = 0 ) { |
| 1562 |
|
|
| 1563 |
|
// disable JSON to avoid conflicts between DB and JSON |
| 1564 |
|
acf_disable_local(); |
| 1565 |
|
|
| 1566 |
|
|
| 1567 |
|
// load the origional field gorup |
| 1568 |
|
$field = acf_get_field( $selector ); |
| 1569 |
|
|
| 1570 |
|
|
| 1571 |
|
// bail early if field did not load correctly |
| 1572 |
|
if( empty($field) ) return false; |
| 1573 |
|
|
| 1574 |
|
|
| 1575 |
|
// delete field |
| 1576 |
|
wp_untrash_post( $field['ID'] ); |
| 1577 |
|
|
| 1578 |
|
|
| 1579 |
|
// action for 3rd party customisation |
| 1580 |
|
do_action( 'acf/untrash_field', $field ); |
| 1581 |
|
|
| 1582 |
|
|
| 1583 |
|
// return |
| 1584 |
|
return true; |
| 1585 |
|
} |
| 1586 |
|
|
| 1587 |
|
|
| 1588 |
|
/* |