You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I realize this could be me... :-) I am trying to preventing taxonomies (all -- categories, tags, etc) from "pulling" into our site. I'm not trying to filter available posts by taxonomy, I just don't want taxonomies to "import" (for lack of better term).
In the function above, I print the post array (print_r($post_array);) and exit the function (just to make sure the filter properly emptied the terms item. It did, yet terms are still being imported. So...
I added some test code to: includes/classes/ExternalConnections/WordPressExternalConnection.php
at line 437. The output did not include terms (hurray!). Yet, still, when I let the process continue, terms are imported.
I noticed the in the WordpressExternalConnection.php file, at line 460, shows this:
if ( ! empty( $post_array['terms'] ) ) {
\Distributor\Utils\set_taxonomy_terms( $new_post, $post_array['terms'] );
}
The conditional seems to check the original $post_array -- not that which has results from the filter ($new_post), however, I think that $new_post is just the insert ID. If I change the above to:
Fortunately, we have introduced a new filter dt_pull_post_terms (#800) to control the terms processing. Please add the following code to your destination site:
This will bypass the terms processing and the terms will not be synced/pulled. Read more here.
With this, closing the ticket as the issue seems resolved with the given code, please feel free to re-open if you find any issues or need more clarification.
Describe the bug
I realize this could be me... :-) I am trying to preventing taxonomies (all -- categories, tags, etc) from "pulling" into our site. I'm not trying to filter available posts by taxonomy, I just don't want taxonomies to "import" (for lack of better term).
This is what I am working with:
function eecs_exclude_taxonomies($post_array) {
$post_array['terms'] = array();
return $post_array;
}
add_filter('dt_pull_post_args', 'eecs_exclude_taxonomies', 10, 3);
To test this, I have done two things:
I added:
$value = apply_filters( 'dt_pull_post_args', $post_array, $item_array['remote_post_id'], $post, $this );
print_r($value);
exit;
at line 437. The output did not include terms (hurray!). Yet, still, when I let the process continue, terms are imported.
I noticed the in the WordpressExternalConnection.php file, at line 460, shows this:
if ( ! empty( $post_array['terms'] ) ) {
\Distributor\Utils\set_taxonomy_terms( $new_post, $post_array['terms'] );
}
The conditional seems to check the original $post_array -- not that which has results from the filter ($new_post), however, I think that $new_post is just the insert ID. If I change the above to:
Terms do not import -- which is exactly what I want to have happen (ideally without changing the core files).
Steps to Reproduce
Expected behavior
I want terms to not import.
Screenshots
Environment information
Site Health Info:
Additional context
The text was updated successfully, but these errors were encountered: