@@ 560-596 (lines=37) @@ | ||
557 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
|
558 | * @return bool true if successful, false otherwise |
|
559 | */ |
|
560 | function delete_transient( $transient ) { |
|
561 | ||
562 | /** |
|
563 | * Fires immediately before a specific transient is deleted. |
|
564 | * |
|
565 | * The dynamic portion of the hook name, `$transient`, refers to the transient name. |
|
566 | * |
|
567 | * @since 3.0.0 |
|
568 | * |
|
569 | * @param string $transient Transient name. |
|
570 | */ |
|
571 | do_action( "delete_transient_{$transient}", $transient ); |
|
572 | ||
573 | if ( wp_using_ext_object_cache() ) { |
|
574 | $result = wp_cache_delete( $transient, 'transient' ); |
|
575 | } else { |
|
576 | $option_timeout = '_transient_timeout_' . $transient; |
|
577 | $option = '_transient_' . $transient; |
|
578 | $result = delete_option( $option ); |
|
579 | if ( $result ) |
|
580 | delete_option( $option_timeout ); |
|
581 | } |
|
582 | ||
583 | if ( $result ) { |
|
584 | ||
585 | /** |
|
586 | * Fires after a transient is deleted. |
|
587 | * |
|
588 | * @since 3.0.0 |
|
589 | * |
|
590 | * @param string $transient Deleted transient name. |
|
591 | */ |
|
592 | do_action( 'deleted_transient', $transient ); |
|
593 | } |
|
594 | ||
595 | return $result; |
|
596 | } |
|
597 | ||
598 | /** |
|
599 | * Get the value of a transient. |
|
@@ 1492-1527 (lines=36) @@ | ||
1489 | * @param string $transient Transient name. Expected to not be SQL-escaped. |
|
1490 | * @return bool True if successful, false otherwise |
|
1491 | */ |
|
1492 | function delete_site_transient( $transient ) { |
|
1493 | ||
1494 | /** |
|
1495 | * Fires immediately before a specific site transient is deleted. |
|
1496 | * |
|
1497 | * The dynamic portion of the hook name, `$transient`, refers to the transient name. |
|
1498 | * |
|
1499 | * @since 3.0.0 |
|
1500 | * |
|
1501 | * @param string $transient Transient name. |
|
1502 | */ |
|
1503 | do_action( "delete_site_transient_{$transient}", $transient ); |
|
1504 | ||
1505 | if ( wp_using_ext_object_cache() ) { |
|
1506 | $result = wp_cache_delete( $transient, 'site-transient' ); |
|
1507 | } else { |
|
1508 | $option_timeout = '_site_transient_timeout_' . $transient; |
|
1509 | $option = '_site_transient_' . $transient; |
|
1510 | $result = delete_site_option( $option ); |
|
1511 | if ( $result ) |
|
1512 | delete_site_option( $option_timeout ); |
|
1513 | } |
|
1514 | if ( $result ) { |
|
1515 | ||
1516 | /** |
|
1517 | * Fires after a transient is deleted. |
|
1518 | * |
|
1519 | * @since 3.0.0 |
|
1520 | * |
|
1521 | * @param string $transient Deleted transient name. |
|
1522 | */ |
|
1523 | do_action( 'deleted_site_transient', $transient ); |
|
1524 | } |
|
1525 | ||
1526 | return $result; |
|
1527 | } |
|
1528 | ||
1529 | /** |
|
1530 | * Get the value of a site transient. |