This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_taxonomy_args_product_cat', 'mrj_remove_parent_category_from_url' ); | |
function mrj_remove_parent_category_from_url( $args ) { | |
$args['rewrite']['hierarchical'] = false; | |
return $args; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* post terms */ | |
if (!function_exists('postTerms')) { | |
function postTerms($taxonomy, $single = true, $linked = false) | |
{ | |
global $post; | |
$terms = get_the_terms($post, $taxonomy); | |
if ($single) { | |
$term = reset($terms); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$transformable_posts = get_posts([ | |
'post_type' => ['microcontent', 'banner'], | |
'post_status' => ['publish', 'draft'], | |
'posts_per_page' => -1 | |
]); | |
if (!empty($transformable_posts)) { | |
foreach ($transformable_posts as $post) { | |
set_post_type($post->ID, 'content'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mrj_change_terms_taxonomy($term_id, $future_taxonomy) | |
{ | |
global $wpdb; | |
$update = $wpdb->update( | |
$wpdb->prefix . 'term_taxonomy', | |
['taxonomy' => $future_taxonomy], | |
['term_taxonomy_id' => $term_id], | |
['%s'], |