Charitable Reporting: Adjusting Initial Filters

add_filter( ‘charitable_report_overview_args’, ‘example_charitable_report_overview_defaults’, 999 ); function example_charitable_report_overview_defaults( $defaults = array() ) { // Defaults array contains: // start_date, end_date, filter, campaign_id, category_id. // The $defaults array contains the default values for the report overview. // You can modify these as…Continue reading

Remove users from WP-JSON

add_filter(‘rest_endpoints’, function( $endpoints ) { if ( isset( $endpoints[‘/wp/v2/users’] ) ) { unset( $endpoints[‘/wp/v2/users’] ); } if ( isset( $endpoints[‘/wp/v2/users/(?P[\d]+)’] ) ) { unset( $endpoints[‘/wp/v2/users/(?P[\d]+)’] ); } return $endpoints; });Continue reading

Disable Author Archives

// Return a 404 page for author pages if accessed directly. add_action( ‘template_redirect’, function () { if ( is_author() ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } ); // Remove the author links. add_filter( ‘author_link’, ‘__return_empty_string’, 1000…Continue reading

Disable Specific Blocks

add_filter( ‘allowed_block_types_all’, function ( $allowed_block_types, $block_editor_context ) { // List here the blocks you want to disallow. https://developer.wordpress.org/block-editor/reference-guides/core-blocks/ $disallowed_blocks = array( ‘core/navigation’, ‘core/query’, ); if ( ! is_array( $allowed_block_types ) || empty( $allowed_block_types ) ) { $registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered(); $allowed_block_types…Continue reading

Add SEO-friendly Breadcrumbs

// You can also use this snippet as a shortcode for more control. global $post; if ( ! is_home() ) { echo ‘ ‘; echo ‘Home / ‘; if ( is_category() || is_single() ) { the_category( ‘ / ‘ );…Continue reading

Allow Contributors to Upload Images

add_filter( ‘user_has_cap’, function ( $allcaps, $caps, $args, $user ) { if ( in_array( ‘contributor’, $user->roles ) && empty( $caps[‘upload_files’] ) ) { $allcaps[‘upload_files’] = true; } return $allcaps; }, 10, 4 );Continue reading