Skip to content

Instantly share code, notes, and snippets.

View danielmcclure's full-sized avatar

Daniel McClure danielmcclure

View GitHub Profile
@danielmcclure
danielmcclure / functions.php
Created February 29, 2024 22:53
Add Prefix to Search & Filter Option Labels
<?php
// Add prefix to Search & Filter Option Labels
function filter_input_object($input_object, $sfid) {
//* Exclude all non-targeted fields
if(($input_object['name']!='_sft_field_name')) {
return $input_object;
}
//* Exclude fields without options
if(!isset($input_object['options'])) {
@danielmcclure
danielmcclure / sf-pro-filter-input-object.php
Created February 6, 2024 23:01 — forked from rmorse/sf-pro-filter-input-object.php
Search & Filter Pro - Filter Input Object
<?php
function filter_input_object($input_object, $sfid)
{
//ensure we are only filtering the correct field name - in this case the field we want to filter has the name `_sfm_colours`
//we also want to make sure its a `select` input type we're filtering
if(($input_object['name']!='_sfm_colours')||($input_object['type']!='select'))
{
return $input_object;
}
@danielmcclure
danielmcclure / functions.php
Created October 23, 2023 21:50
Enable Custom ACF Blocks in Newsletter Glue
<?php
// Update Allowed Blocks in Newsletter Glue
function add_custom_allowed_blocks( $blocks ) {
// Add your custom block to the array
$blocks[] = 'acf/my-block'; // Change to your block's actual name. Use hyphens instead of underscores.
return $blocks; // Return modified array
}
add_filter( 'newsletterglue_allowed_block_list', 'add_custom_allowed_blocks', 10 );
@danielmcclure
danielmcclure / functions.php
Created August 22, 2023 07:27
Change Default WordPress Sender Email
<?php
// Edit the address and name below
add_filter( 'wp_mail_from', function ( $original_email_address ) {
return 'your.email@example.com';
} );
// Change the From name.
add_filter( 'wp_mail_from_name', function ( $original_email_from ) {
return 'Your Name';
@danielmcclure
danielmcclure / functions.php
Created June 21, 2023 22:47
Disable WP Auto Update Notifications
<?p
// Disable WordPress Core Update Notifications
add_filter( 'auto_core_update_send_email', 'tme_stop_auto_update_emails', 10, 4 );
function tme_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
did:3:kjzl6cwe1jw149pq10l6kbqttbfbwnhv8ehlots9lyldw2a54ztg6kmlrfknurz
@danielmcclure
danielmcclure / functions.php
Created March 22, 2021 01:37
Stop Recording IP Address with WordPress Comments
<?php
// Stop Recording IP Address with WordPress Comments
function dm_remove_comments_ip( $comment_author_ip ) {
return '';
}
add_filter( 'pre_comment_user_ip', 'dm_remove_comments_ip' );
@danielmcclure
danielmcclure / learndash-code-in-answer.php
Created July 13, 2020 03:45 — forked from tradesouthwest/learndash-code-in-answer.php
LearnDash cloze answer accept case sensitive
<?php
/**
* LearnDash filter to prevent converting answer values to lowercase
*
* @possibly use ld_adv_quiz_pro_ajax()
* @uses stripslashes( strtolower( trim( $userResponse ) ) ) Default
* @since 1.0
* @from WpProQuiz_View_FrontQuiz.php
* post_type=sfwd-quiz
*/
@danielmcclure
danielmcclure / functions.php
Created May 23, 2020 04:37
Remove Post Links from WordPress Dashboard
<?php
// Remove Posts from Dashboard Sidebar
function m3_post_remove () {
remove_menu_page('edit.php');
}
add_action('admin_menu', 'm3_post_remove'); //adding action for triggering function call
// Remove Posts from Admin Menu
function m3_remove_wp_nodes() {
@danielmcclure
danielmcclure / remove-custom-post-type-slug-from-permalinks.php
Last active May 23, 2020 02:03 — forked from kellenmace/remove-custom-post-type-slug-from-permalinks.php
Remove custom post type slug from permalinks in WordPress
<?php
// Safely Remove CPT slugs from your CPT permalinks.
// Note: Replace CPT_NAME with your CPT name.
/**
* Remove the slug from published post permalinks. Only affect our custom post type, though.
*/
function m3_remove_cpt_slug( $post_link, $post ) {
if ( 'CPT_NAME' === $post->post_type && 'publish' === $post->post_status ) {