@@ 574-610 (lines=37) @@ | ||
571 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
|
572 | * @return bool true if successful, false otherwise |
|
573 | */ |
|
574 | function delete_transient( $transient ) { |
|
575 | ||
576 | /** |
|
577 | * Fires immediately before a specific transient is deleted. |
|
578 | * |
|
579 | * The dynamic portion of the hook name, `$transient`, refers to the transient name. |
|
580 | * |
|
581 | * @since 3.0.0 |
|
582 | * |
|
583 | * @param string $transient Transient name. |
|
584 | */ |
|
585 | do_action( "delete_transient_{$transient}", $transient ); |
|
586 | ||
587 | if ( wp_using_ext_object_cache() ) { |
|
588 | $result = wp_cache_delete( $transient, 'transient' ); |
|
589 | } else { |
|
590 | $option_timeout = '_transient_timeout_' . $transient; |
|
591 | $option = '_transient_' . $transient; |
|
592 | $result = delete_option( $option ); |
|
593 | if ( $result ) |
|
594 | delete_option( $option_timeout ); |
|
595 | } |
|
596 | ||
597 | if ( $result ) { |
|
598 | ||
599 | /** |
|
600 | * Fires after a transient is deleted. |
|
601 | * |
|
602 | * @since 3.0.0 |
|
603 | * |
|
604 | * @param string $transient Deleted transient name. |
|
605 | */ |
|
606 | do_action( 'deleted_transient', $transient ); |
|
607 | } |
|
608 | ||
609 | return $result; |
|
610 | } |
|
611 | ||
612 | /** |
|
613 | * Get the value of a transient. |
|
@@ 1526-1561 (lines=36) @@ | ||
1523 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
|
1524 | * @return bool True if successful, false otherwise |
|
1525 | */ |
|
1526 | function delete_site_transient( $transient ) { |
|
1527 | ||
1528 | /** |
|
1529 | * Fires immediately before a specific site transient is deleted. |
|
1530 | * |
|
1531 | * The dynamic portion of the hook name, `$transient`, refers to the transient name. |
|
1532 | * |
|
1533 | * @since 3.0.0 |
|
1534 | * |
|
1535 | * @param string $transient Transient name. |
|
1536 | */ |
|
1537 | do_action( "delete_site_transient_{$transient}", $transient ); |
|
1538 | ||
1539 | if ( wp_using_ext_object_cache() ) { |
|
1540 | $result = wp_cache_delete( $transient, 'site-transient' ); |
|
1541 | } else { |
|
1542 | $option_timeout = '_site_transient_timeout_' . $transient; |
|
1543 | $option = '_site_transient_' . $transient; |
|
1544 | $result = delete_site_option( $option ); |
|
1545 | if ( $result ) |
|
1546 | delete_site_option( $option_timeout ); |
|
1547 | } |
|
1548 | if ( $result ) { |
|
1549 | ||
1550 | /** |
|
1551 | * Fires after a transient is deleted. |
|
1552 | * |
|
1553 | * @since 3.0.0 |
|
1554 | * |
|
1555 | * @param string $transient Deleted transient name. |
|
1556 | */ |
|
1557 | do_action( 'deleted_site_transient', $transient ); |
|
1558 | } |
|
1559 | ||
1560 | return $result; |
|
1561 | } |
|
1562 | ||
1563 | /** |
|
1564 | * Get the value of a site transient. |