apply_filters( 'relevanssi_add_attachment_scripts', bool $add, string $post_type )

This filter hook controls where Relevanssi adds the attachment handling scripts.


(boolean) Whether to add the scripts. Default: true for the attachment post type, false otherwise.

(string) The post type of the current post.

More information

If you want to use Relevanssi attachment reading for other post types than attachment, you can use this filter hook to add the Relevanssi attachment javascript files to the post editor for that post type.

If your post type is document, you’d do this:

add_filter( 'relevanssi_add_attachment_scripts', function( $add, $post_type ) {
  if ( 'document' === $post_type ) {
    $add = true;
  return $add;
}, 10, 2 );