Categories::terms_clauses( array $pieces, array $taxonomies, array $args )

Description #

Modify term clauses.

Parameters #

  • $pieces
    array (Required) MySql query parts.
  • $taxonomies
    array (Required) Taxonomies.
  • $args
    array (Required) Args.

Source #

File: addons/categories/categories.php

	public function terms_clauses( $pieces, $taxonomies, $args ) {
		if ( ! in_array( 'question_category', $taxonomies, true ) || ! isset( $args['ap_query'] ) || 'subscription' !== $args['ap_query'] ) {
			return $pieces;
		}

		global $wpdb;

		$pieces['join']  = $pieces['join'] . ' INNER JOIN ' . $wpdb->prefix . 'ap_meta apmeta ON t.term_id = apmeta.apmeta_actionid';
		$pieces['where'] = $pieces['where'] . " AND apmeta.apmeta_type='subscriber' AND apmeta.apmeta_param='category' AND apmeta.apmeta_userid='" . $args['user_id'] . "'";

		return $pieces;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment