Modify output of wp_dropdown_categories to add term IDs to each option

get_terms ended up bring a more customizable solution which is working for my needs. I was able to easily add the term IDs to each option as needed. Hope this helps someone else. <div class=”location-cats-dropdown”> <form id=”location-category-select” class=”location-category-select” method=”get”> <?php $loc_cats = get_terms( array( ‘taxonomy’ => ‘location_category’, ‘hide_empty’ => true, ‘orderby’ => ‘menu_order’, ‘order’ => … Read more

Why can’t I return a value from $wpdb->get var?

get_results() by default returns each databse row as object, so $survey_mapping is an array of objects. Therefore you should replace $row with $row->surveyid in the second query: $dup_survey2 = absint( $wpdb->get_var( $wpdb->prepare(“SELECT surveyls_survey_id FROM oc_surveys_languagesettings WHERE surveyls_survey_id = %d”, $row->surveyid) )); and in $wpdb->delete(): array(‘surveyid’ => absint($row->surveyid)) By the way, you can use a single … Read more

Multiple Custom Taxonomy Dropdowns Lists

The “dropdown” element declared and used in each of these functions is the same, so the last one is overriding all previous. Specifying different terms each time fixes the problem: var writerdropdown = document.getElementById(“writers”); function onWriterChange() { if ( writerdropdown.options[writerdropdown.selectedIndex].value != -1 ) { location.href = “<?php echo home_url();?>/writer/”+writerdropdown.options[writerdropdown.selectedIndex].value+”/”; } } writerdropdown.onchange = onWriterChange; var … Read more

Add “Select All” to custom taxonomy

You don’t have to rebuild the metabox… you can just add a pseudo term via the get_terms filter. This will add an “All Terms” term to your checkbox list, (assuming a hierarchical taxonomy). add_filter( ‘get_terms’, ‘wpa104168_all_terms’, 10, 3 ); function wpa104168_all_terms ( $terms, $taxonomies, $args ){ if ( is_admin() && function_exists( ‘get_current_screen’ ) && ! … Read more

add onchange to select in a wp form

you can add any attribute to <select> using wordpress filter wp_dropdown_cats . wp_dropdown_cats filter allows you to modify the content of the taxonomy drop-down output. Try below code. function addAttributeToDropdown($html_content){ $html_content = str_replace(‘<select’,'<select onchange=”myFunc()”‘,$html_content); return $html_content; } add_filter(‘wp_dropdown_cats’,’addAttributeToDropdown’); add this inside your functions.php file

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)