The Avada doc suggests that if you want to create a custom fusion builder element that includes a dropdown where you can pick a term from a custom taxonomy, that you do it like so:
function fusion_element_custom_quotes() { fusion_builder_map( array( 'name' =>; esc_attr__( 'Quotes', 'fusion-builder' ), 'shortcode' =>; 'iss-custom-quotes', 'icon' =>; 'fusiona-font', 'allow_generator' => true, 'params' =>; array( array( 'type' =>; 'select', 'heading' => esc_attr__( 'Quote Category', 'fusion-builder' ), 'description' => esc_attr__( 'Select a category of quotes to display.', 'fusion-builder' ), 'param_name' => 'quote_category', 'value' => fusion_builder_shortcodes_categories('quote_category', true, 'All'), 'default' => '', ) ) ) ); } add_action( 'fusion_builder_before_init', 'fusion_element_custom_quotes' );
Unfortunately, if you are using a custom taxonomy, your dropdown will always appear blank with the above code.
The fix is extraordinarily easy, and it’s maddening that they don’t mention this in their docs — most custom post types and their taxonomies are registered using the “init” hook, but the suggested hook for creating a fusion builder element is “fusion_builder_before_init”
This means that when your fusion builder element is added, your custom taxonomy will not have been registered yet.
However, there doesn’t appear to be any change in functionality if you change your hook to init. The only part of the above that needs to change is:
add_action( 'fusion_builder_before_init', 'fusion_element_custom_quotes' );
to
add_action( 'init', 'fusion_element_custom_quotes' );
Bam, working dropdown. Hope this saves someone else from googling like crazy for caching workarounds or similar.
Leave A Comment