0

I would like to create the same same Object wp_dropdown_categories creates, but this time using a custom query. I was to use $wpdb and create exactly the same effect.

This is for a different project that uses the same WP database structure

**Clarifications **

I created a Laravel 5.3 application and am coding a custom functionality for taxonomies, just like in Wordpress. It uses the same tables as in wordpress.i.e _terms , _term_taxonomy....

The _terms table has columns "term_id" "name" "slug" The _term_taxonomy table has columns "term_tax_id" "term_id" ..... and "parent". The two tables are joined by the "term_id" columns. The "parent" column stired the parent term_id

I can run the join query successfully, it only gets complicated when I get to isolate children and the levels of ancestry vis-à-vis the parent term_id.

I tried to check in Wordpress /wp-includes/taxonomy.php but it is not clear, hence trying WPSE

In other words, I want to achieve what wp_dropdown_categories achieves, with a structure like I just explained.

1
  • 1
    Hello, welcome WPSE. No one will be able to answer your question with such little information. Please provide a code sample with a detailed explanation. And any research you have done on this subject.
    – ngearing
    Commented Sep 16, 2016 at 5:43

1 Answer 1

0

It's easy if you want to use a different taxonomy. Just change the 'category' value below to whatever your taxonomy name is.

<?php
  wp_dropdown_categories( array(
    'taxonomy' => 'category',
  ) );
?>

For additional parameters, see the full list on the WordPress Codex.

1
  • Thanks for the contribution. Please check the more detailed description
    – Coditiv
    Commented Sep 16, 2016 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.