Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search for media and exclude search from media in custom post type › Reply To: Search for media and exclude search from media in custom post type
Thanks Ernest. Regarding the 2nd issue, the code worked perfectly, many thanks.
Regarding the 1st issue I still get some problems. First I corrected the
function asp_custom_footer_script( $results ) {
part to
function asp_remove_attachments_where_post_type( $results ) {
as the filter was named like that :).
but again I get results from pages or normal posts… Ideally I need dokuments that I have uploaded through a file upload field I created through advanced custom fields pro for this specific custom post type (‘newsroom’) :/
PS. Why “if ( isset($r->post_type) && $r->post_type == ‘attachment’ ) {” …? I have created this custom post type like this:
register_post_type(
'newsroom', array(
'label' => __( 'newsroom' ),
'labels' => array(
'name' => __( 'Newsroom' ),
'singular_name' => __( 'Newsroom' ),
'add_new' => 'Neuen Newsroom Beitrag einfügen',
),
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', ),
'hierarchical' => false,
'rewrite' => array('slug' => 'newsroom','with_front' => false),
'public' => true,
'show_ui' => true,
'menu_icon' => 'dashicons-media-spreadsheet',
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => false,
'capability_type' => 'post'
)
);
-
This reply was modified 4 years, 4 months ago by
zisis19.