Disable Search

// Prevent search queries. add_action( ‘parse_query’, function ( $query, $error = true ) { if ( is_search() && ! is_admin() ) { $query->is_search = false; $query->query_vars[‘s’] = false; $query->query[‘s’] = false; if ( true === $error ) { $query->is_404 =…Continue reading

Delay Posts in RSS Feeds

function wpcode_snippet_publish_later_on_feed( $where ) { global $wpdb; if ( is_feed() ) { // Timestamp in WP-format. $now = gmdate( ‘Y-m-d H:i:s’ ); // Number of unit to wait $wait = ’10’; // integer. // Choose time unit. $unit = ‘MINUTE’;…Continue reading

Change Read More Text for Excerpts

function wpcode_snippets_change_read_more( $read_more, $read_more_text ) { // Edit the line below to add your own “Read More” text. $custom_text = ‘Read the whole post’; $read_more = str_replace( $read_more_text, $custom_text, $read_more ); return $read_more; } add_filter( ‘the_content_more_link’, ‘wpcode_snippets_change_read_more’, 15, 2 );Continue reading

Exclude Specific Categories from RSS Feed

/** * Exclude a category or multiple categories from the feeds. * If you want to exclude multiple categories, use a comma-separated list: “-15, -5, -6”. * Make sure to prefix the category id(s) with a minus “-“. * *…Continue reading

Allow SVG Files Upload

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading