Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:17:24+00:00 2026-06-13T00:17:24+00:00

Here is the dilemma I have, my theme options passes the custom taxonomy variable

  • 0

Here is the dilemma I have, my theme options passes the custom taxonomy variable as an ID number, not the slug name. So instead of passing “news” it passses “4”.

I have this hard code that works:

$wp_query = new WP_Query(array('slidecat' => 'extra', 'showposts'=>$slides));

But this code only works with the slug. So if i replace the ‘extra’ with $slider_category which is the variable my select field in the theme options passes, the code doesn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:17:25+00:00Added an answer on June 13, 2026 at 12:17 am

    If you have the taxonomy ID, then it’s easier to just query the database directly to get to the slug:

    function get_term_by_taxonomy_id($term_taxonomy_id) {
        global $wpdb;
        $taxonomy = $wpdb->get_row( $wpdb->prepare( 
            "SELECT * FROM $wpdb->term_taxonomy wta
                INNER JOIN $wpdb->terms wt ON (wta.term_id = wt.term_id)
                WHERE wta.term_taxonomy_id = %d", $term_taxonomy_id 
        ) );
    
        return $taxonomy;
    }
    
    $cat = get_term_by_taxonomy_id($slider_category);
    // at this point you should check if $cat is null (in case of an error)
    $wp_query = new WP_Query(array('slidecat' => $cat->slug, 'showposts'=>$slides));
    

    Of course the slug can be applied to different taxonomies, for example there could by a category and a post_tag with a slug named "hello". So it depends on how slidecat is implemented and which taxonomies are supported.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of a dilemma here. I have a drupal 7 database
Here's my dilemma: I have to RGBA RAW images: a master image (the first)
I've came across a dilemma which I think is worth discussing here. I have
Here is my dilemma: The Problem I have SubProgram (a DLL) that uses System.Data.SQLite
I have a dilemma going on here. I need to use a session to
Here's my dilemma. I have 2 animations that need to run sequentially. The first
So here is my dilemma: I have a base class (Let's say a generic
Here is my dilemma: I really like lambda and have been using Boost.Fusion and
Here is my dilemma... I basically have a script which by means of CURL
Here is my dilemma; I have on my page a table as such: <table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.