I am while using query below to output all links from the custom taxonomy. It results all posts which are labeled 'http' in the taxonomy 'words'.

I must exclude some general groups in the output. So, further ed. it only results links in media and news groups. An amount be the easiest method to accomplish this?

$wp_query->request = "

SELECT DISTINCT *

FROM $wpdb->posts

LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)

LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)

LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)

WHERE $wpdb->posts.post_type = 'post' 

AND $wpdb->posts.post_status = 'publish'

AND $wpdb->term_taxonomy.taxonomy = 'words'

AND $wpdb->terms.slug = 'http'

ORDER BY $wpdb->posts.post_date DESC

LIMIT $ppp OFFSET $offset";

$pagelinkposts = $wpdb->get_results($wp_query->request, OBJECT);

I in some way found the answer myself by utilizing codes from another wordpress plugin. If another person want to offer the same factor add the below prior to the ORDER BY line (and alter category-ids towards the ones you need to include.)

AND object_id IN
           (
            SELECT object_id
            FROM $wpdb->term_relationships AS r
            JOIN $wpdb->term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id
            JOIN $wpdb->terms AS t ON t.term_id = x.term_id
            WHERE   x.taxonomy = 'category'
            AND t.term_id IN  (category-ids))