Filters
Nectarblocks exposes a small set of PHP filters for site-specific behavior that has no UI. Add them from a child theme's functions.php or a small custom plugin.
nectar_global_sections_assign_capability
The capability a user needs to assign Display Locations and Display Conditions to a Global Section. Editing the section's content follows the normal post permissions; only the "where does this render" metaboxes are gated here.
- Signature:
apply_filters( 'nectar_global_sections_assign_capability', string $capability ) - Default:
'manage_options' - Since: 3.2.0
An empty or non-string return falls back to the default.
add_filter( 'nectar_global_sections_assign_capability', function ( $capability ) {
// Let editors decide where global sections appear.
return 'edit_others_posts';
} );
nectar_global_section_allowed_locations
The list of theme hooks a Global Section may attach to. Locations stored on a section are only rendered when their hook is in this list, so a section pointed at a hook that is not offered by the editor is silently skipped. Use this to add hooks from your own templates, or to remove hooks you do not want used.
- Signature:
apply_filters( 'nectar_global_section_allowed_locations', string[] $hooks ) - Default: every hook offered by the Display Locations picker
- Since: 3.2.0
Non-string and empty entries are dropped from the returned list.
add_filter( 'nectar_global_section_allowed_locations', function ( array $hooks ) {
// Allow sections to render on a hook fired by a custom template.
$hooks[] = 'my_theme_after_pricing_table';
return $hooks;
} );
nectar_custom_font_list
Register a font by URL when it cannot be uploaded through the Custom Fonts screen. The filter and its expected array shape are documented on the Adding External Fonts page.