Taxonomy terms – Get a list of all entity reference fields that refer to specific entity types

Is there a way to obtain a list of entity reference fields by field type (similar to that produced by $ all_reference_fields = $ this-> entityFieldManager-> getFieldMapByFieldType (& # 39; entity_reference & # 39;);) but filtered to list only entity reference fields containing target entity types and sets corresponding to a specified list.

I do not see anything in entityFieldManager that would easily filter the results of the getFieldMap () or getFieldMapByFieldType () I am only looking for specific reference fields because the mapping does not contain any storage information in the field, which contains the list of target sets and managers.

Looks like the entity_reference module in the kernel does not provide any service that would be logical place for something like this, so I currently think I'll have to do it in two steps:

  1. Call getFieldMapByFieldType (& # 39; entity_reference & # 39;);.
  2. Browse each type of entity in the field map and call buildFieldStorageDefinitions ($ entity_type); or something of that nature, to understand the target entity_type: file_name combinations, and hunt down the fields that reference & # 39; taxonomy_term: tag & # 39;. This seems horribly inefficient, because of the large number of entity_reference fields on this site, so maybe there is a better way to do this step?

In an ideal world, there would be only a set of database calls that I could perform, or even a service at the heart of the entity_reference module! (wishful thinking);)

Custom Publication Types – WP Query Conditional Meta Query and Taxonomy

I am developing a plugin that includes a custom publication type displayed as a list in WP Admin.

There are different levels of users defined in the plug-in and some other options to determine which publications are displayed for the currently logged-in user. In addition, publications can belong to a custom taxonomy. In this case, other conditions must determine which publications the current user sees. For example, the current user should perhaps see all publications with the term Support of Taxonomy Department.

I hang on to pre_get_posts in order to build the query by ensuring that the current user only sees the publications that he should have. Administrators see everything, others see only the messages to which they are assigned. All of this works well with standard meta queries.

That's the taxonomy with which I have a problem. I understand that it is not possible to create a WP query to query publications in which a key meta exists and corresponds to a value OR the publication is associated with a specific taxonomy term, unless I build a database query of its own

What is the best way to do this by minimizing database queries?

I have posted below my current request. I am looking for advice on the best hook to use and a query to use in order to get what I need.

function kbs_restrict_agent_ticket_view ($ query) {

if (! is_admin () || # kbs_ticket # = $ query-> get (& # 39; post_type & # 39;)) {
return;
}

$ admin_agents = kbs_get_option (& # 39; admin_agents & # 39;);

if (empty ($ admin_agents) && current_user_can (& # 39;) & nbsp;) {
$ query-> set (& # 39 ;, & # 39; 99999999 & # 39;);
return;
}

// If the user is admin and administrators are agents, they see everything.
if (current_user_can (& # 39; manage_ticket_settings & # 39;)) {
return;
}

if (kbs_get_option (& # 39; restrict_agent_view & # 39 ;, false)) {
$ agent_id = get_current_user_id ();

$ meta_query = array (
& # 39; relationship & # 39; => & # 39; OR & # 39 ;,
board (
& # 39; key & # 39; => & # 39; _kbs_ticket_agent_id & # 39;
& # 39; value & # 39; => $ Agent_id,
& # 39; like & # 39; => NUMERIC & # 39;
)
board (
& # 39; key & # 39; => & # 39; _kbs_ticket_agent_id & # 39;
& # 39; value & # 39; => & # 39;
)
board (
& # 39; key & # 39; => & # 39; _kbs_ticket_agent_id & # 39;
& # 39; value & # 39; => No matter what,
& # 39; compare & # 39; => NOT EXISTS & # 39;
)
)

if (kbs_multiple_agents ()) {
$ meta_query[] = table (
& # 39; key & # 39; => & # 39; _kbs_ticket_agents & # 39;
& # 39; value & # 39; => Sprintf (& # 39;:% d; & # 39 ;, $ agent_id),
& # 39; compare & # 39; => & # 39; LIKE & # 39;
)
}

$ query-> set (& # 39; meta_query & # 39 ;, $ meta_query);

}

} // kbs_restrict_agent_ticket_view
add_action (& # 39; pre_get_posts & # 39; kbs_restrict_agent_ticket_view & # 39;);

I am actually looking for OR term mail (& # 39; support & # 39 ;, & # 39; department & # 39;)

custom taxonomy – How can I display content on sub-categories of Woocommerce products belonging to a specific parent category?

I try to display a short message under each product for all products belonging to subcategories of a parent category

Parent category
| -------- Sub Category 1
| -------- Sub category 2
| -------- Subcategory 3

I've had up to post the message on all products in all categories with the help of the following function, but that's not what I want, the message has to be displayed only on product listings in subcategories belonging to the specific parent. Category.

add_action (& # 39; woocommerce_after_shop_loop_item_title & # 39; ex_display_notice & # 39;);
function ex_display_notice () {
if (is_tax (& # 39; product_cat & # 39;) || cat_is_ancestor_of (129, get_query_var (& # 39; cat)))) {
echo & # 39;
& # 39 ;; echo - This is an old display product! & # 39 ;; echo & # 39;
& # 39 ;; } }

I hope someone can help you, thank you.

8 – How can I add the taxonomy terms that a user has added to a node in his profile?

I want to have a file on each user called "My interests".

Is it possible to automatically fill in this field with the taxonomy terms that the user adds to his nodes?

Thus, when a user creates an article with some terms, these are added to his profile. The next time he / she will add a new node, the taxonomy terms of that node will also be added to his profile. Preferably no duplicates.

Is there a way to do this without a custom code? I am not at this level unfortunately.

8 – Pathauto mass update for taxonomy terms with "Generate automatic URL alias" unchecked

I have the same problem for D7 here:
Generating URL aliases for taxonomy terms does not do anything
or here:
Bulk update for the "Generate an automatic URL alias" checkbox

And I'm looking for a corresponding workaround for D8, querying the database directly.

For D7, the following solution seems to work:

UPDATE pathauto_state SET pathauto = "1" WHERE entity_type = "taxonomy_term";

I've done some research for D8:

  1. can not find a "pathauto_state" table in a D8 database
  2. I've therefore tried to find out how and where to "Generate an Automatic URL Alias"
    is stored but
    without success (see also for this:
    Where is the "Generate Automatic URL Alias" setting stored?

Thank you

How is the computer with FPU classified in the Flynn taxonomy?

How is the computer with FPU classified in the Flynn taxonomy? If the machine has a processor with only one core, but also an FPU, is it SISD or SIMD?

categories – get a taxonomy list in a wordpress page

I have this code in a WP page to display the default category

    & # 39; & # 39 ;, name
& # 39; order & # 39; => & # 39; ASC & # 39 ;,
& # 39; Exclude & # 39; => & # 39; 115,116,1,135,19,124,133,126,189 & quot ;,
));
foreach (categories $ as category $) {
echo & # 39;& # 39 ;;
echo & # 39;
& # 39 ;; }?>

Do you have an idea to post new taxonomies on WordPress? Use this code