acf/connect_attachment_to_post
Filters whether or not to connect the attachment.
Usage
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.
Default: true - $attachment_id(int)
- The attachment ID.
- $post_id(int)
- The post ID.
Changelog
| Since 5.8.0 | Introduced. |
Where the hook is called
acf/connect_attachment_to_post
acf/includes/api/api-helpers.php 4128
if ( ! apply_filters( 'acf/connect_attachment_to_post', true, $attachment_id, $post_id ) ) {