Add_filter (' get_terms ', ' get_subcategory_terms ', 10, 3);
function Get_subcategory_terms ($terms, $taxonomies, $args) {
$new _terms = Array ();
if (In_array (' Product_cat ', $taxonomies) &&! is_admin () && is_shop ()) {
foreach ($terms as $key = = $term) {
$new _terms[] = $term;
}
$terms = $new _terms;
}
return $terms;
}
This is the current code. There is a table in my database that has a field that is term_id I have the term_id of the categories that need to be displayed $duqu inside I want to ask how to insert this variable into the above code can only show those selected term_id classification it?
Reply to discussion (solution)
You give the code at all can not find term_id and $duqu, how to help you change
Generally want to meet your requirements, pass a judgment on it!
You give the code at all can not find term_id and $duqu, how to help you change
Generally want to meet your requirements, pass a judgment on it!
Sorry, it's a little busy to come back to the post
Yes, that's the code that came with the program. I don't know what's going on with those term_id. The name of the variable may not be the same as it was from the database table.
I did a little research and found a solution, but there's one place that can't be bothered.
if (! In_array ($term->slug, Array ())) {
$new _terms[] = $term;
}
I used this program to make some categories not show for example, I don't want to show the classification of slug value A as an array (' a ') you can
But I don't think it shows a lot.
$SHAIXUANKUWP _terms=mysql_query ("select * from ' wp_terms ' where term_id= '". $duqu _term_id. "");
I've screened out all the rows I want to not show in this section.
while ($DUQUSHUJUKUWP _terms=mysql_fetch_array ($SHAIXUANKUWP _terms)) {$duqu _slug= $duqushujukuwp _terms[slug];}
This paragraph of my line read out the classification of the Slug
But I don't know how to put $duqu_slug this all into the above array () inside the array () it seems that arrays () can not be placed in the list only one
Help me see how to change it.
while ($DUQUSHUJUKUWP _terms=mysql_fetch_array ($SHAIXUANKUWP _terms)) {$duqu _slug[]= $duqushujukuwp _terms[slug];}
$duqu _slug is an array of rows you don't want to display.
while ($DUQUSHUJUKUWP _terms=mysql_fetch_array ($SHAIXUANKUWP _terms)) {$duqu _slug[]= $duqushujukuwp _terms[slug];}
$duqu _slug is an array of rows you don't want to display.
Thanks, but it's settled.