This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • in reply to: Ignore unlinked Attachments #21520
    AdditiveFXAdditiveFX
    Participant

    perfect! Thanks for your help

    in reply to: Ignore unlinked Attachments #21518
    AdditiveFXAdditiveFX
    Participant

    To be clear, this is the working code:

    add_filter('asp_results', 'asp_results_remove_unlinked_attachments');
    function asp_results_remove_unlinked_attachments($results) {
        foreach ($results as $k=>&$r) {
            if ( isset($r->post_type) && $r->post_type == 'attachment' ) {
    			$parent_id = wp_get_post_parent_id( $r->id );
                if ( is_wp_error($parent_id) || empty($parent_id) ) {
                    // Remove the post from the results list	
    				unset($results[$k]);
    			}
            }
        }
    	return $results;	
    }
    in reply to: Ignore unlinked Attachments #21517
    AdditiveFXAdditiveFX
    Participant

    Hey,

    it works now with your proposed fix! The results are indeed of post-type “attachment”. Content type is still “pagepost” for everything. When I print the post-type somewhere I get sensible strings like “attachment”, “event”, “page” and “post”

    This is solved. Would be interesting to know why the first solution doesn’t work for me.

    I’m using the index table engine, I have several custom post types in WordPress, I have indexed all of them including file contents – Seems like a normal use of your plugin, doesn’t it? 🙂
    Btw. this is an awesome plugin! Really happy with it!

    in reply to: Ignore unlinked Attachments #21514
    AdditiveFXAdditiveFX
    Participant

    I have version 4.14.6, on codecanyon that’s the newest version, right?

    in reply to: Ignore unlinked Attachments #21512
    AdditiveFXAdditiveFX
    Participant

    Hi,
    I have tried this and no luck.

    I think I know why it is not working: when I return $r->content_type somewhere visible it’s always “pagepost” – never “attachment”

    Is there something wrong in my settings?

    add_filter('asp_results', 'asp_results_remove_unlinked_attachments');
    function asp_results_remove_unlinked_attachments($results) {
        foreach ($results as $k=>&$r) {
           $results[$k]->title = $r->content_type;
        }
    	return $results;	
    }

    this always returns “pagepost” as the search item title.

    in reply to: Ignore unlinked Attachments #21404
    AdditiveFXAdditiveFX
    Participant

    Hey, thanks for the speedy reply 🙂

    I have implemented this and it doesn’t seem to work :/ Is this supposed to also filter the AJAX results?
    Right now there is no difference in the results, do I need to empty some sort of cache in your plugin for the changes to take effect?

    Thanks!

Viewing 6 posts - 16 through 21 (of 21 total)