acf/connect_attachment_to_post
Filters whether or not to connect the attachment.
Использование
add_filter( 'acf/connect_attachment_to_post', 'wp_kama_acf_connect_attachment_to_post_filter', 10, 3 ); /** * Function for `acf/connect_attachment_to_post` filter-hook. * * @param bool $bool Returning false will prevent the connection. * @param int $attachment_id The attachment ID. * @param int $post_id The post ID. * * @return bool */ function wp_kama_acf_connect_attachment_to_post_filter( $bool, $attachment_id, $post_id ){ // filter... return $bool; }
- $bool(true|false)
- Returning false will prevent the connection.
По умолчанию: true - $attachment_id(int)
- The attachment ID.
- $post_id(int)
- The post ID.
Список изменений
С версии 5.8.0 | Введена. |
Где вызывается хук
acf/connect_attachment_to_post
acf/includes/api/api-helpers.php 4270
if ( ! apply_filters( 'acf/connect_attachment_to_post', true, $attachment_id, $post_id ) ) {