• Resolved Maximus

    (@abayomi222)


    Hello,

    The following script helps me to use this url to auto select a specific category =>wp-admin/post-new.php?category=scrib.
    Now this when called via url, will select the scrib category.
    This is the script …
    add_filter(‘wp_get_object_terms’, function($terms, $object_ids, $taxonomies, $args){
    if (!$terms && basename($_SERVER[‘PHP_SELF’]) == ‘post-new.php’) {

    // Category – note: only 1 category is supported currently
    if ($taxonomies == “‘category'” && isset($_REQUEST[‘category’])) {
    $id = get_cat_id($_REQUEST[‘category’]);
    if ($id) {
    return array($id);
    }
    }

    }
    return $terms;
    }, 10, 4);

    I created a custom post type called “Product” and a custom taxonomy for it called “Product-Typo” .
    How do i use the above script to do same and it will auto select the Product-Typo taxonomy? I have tried everything but it did not work. Please help.
    Lets assume this is the url => wp-admin/post-new.php?post_type=product&product-typo=branded

    https://wordpress.org/plugins/custom-post-type-maker/

  • The topic ‘Auto selection of taxonomy’ is closed to new replies.