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

“New” Badge for Recent Posts (copy)

add_filter( ‘the_title’, function ( $title, $id ) { if ( ! is_admin() && is_single( $id ) ) { $number_of_days = 7; $post_date = get_the_date( ‘U’, $id ); $current_date = current_time( ‘timestamp’ ); $date_diff = $current_date – $post_date; if ( $date_diff…Continue reading

WP Simple Pay: Add Email Address to Payment Confirmation URL

add_action( ‘template_redirect’, function() { if ( ! function_exists( ‘\SimplePay\Core\Payments\Payment_Confirmation\get_confirmation_data’ ) ) { return; } $data = \SimplePay\Core\Payments\Payment_Confirmation\get_confirmation_data(); if ( empty( $data ) ) { return; } $customer = $data[‘customer’]; $email = $customer->email; if ( isset( $_GET[’email’] ) ) { return;…Continue reading

No Index Search Results

function noindex_search_results() { if ( is_search() ) { ob_start(‘add_noindex_to_search’); } } add_action( ‘template_redirect’, ‘noindex_search_results’ ); function add_noindex_to_search($buffer) { if ( preg_match(‘/Continue reading

Dashboard hidden page

function create_hidden_page() { // Check if the page already exists by slug $page_slug = ‘rubberduckers’; $page_title = ‘Rubber Duckers Dashboard’; $page_content = ”; $author_id = 1; // ID of the ‘rubberduckers’ user $existing_page = get_page_by_path($page_slug); if (!$existing_page) { // Create…Continue reading

Create Additional Formats for the Date Field

/* Add additional formats for the Date field Date Picker. Original doc link: https://wpforms.com/developers/how-to-create-additional-formats-for-the-date-field/ For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_dev_date_field_formats( $formats ) { // Item key is JS date character – see https://flatpickr.js.org/formatting/ // Item value is in…Continue reading