Skip to content

Instantly share code, notes, and snippets.

@dexit
dexit / api.php
Created May 3, 2019 17:32
Disable WordPress REST API endpoints
// Remove init rest routes
remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 );
// Remove oembed rest routes
function remove_json_api () {
// Remove the REST API lines from the HTML Header
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
@eduwass
eduwass / docker-compose.yml
Last active December 31, 2023 00:31
Mailhog + WordPress in docker-compose.yml
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@jaredatch
jaredatch / functions.php
Last active February 28, 2022 22:04
WordPress Search Autocomplete using WP REST API v2
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@jonbish
jonbish / Trash Redirect WordPress Plugin
Created October 22, 2012 17:18
301 Redirect trashed posts to the home page instead of a 404 page
<?php
/*
Plugin Name: Trash Redirect
Description: 301 Redirect trashed posts to the home page instead of a 404 page
*/
add_action('template_redirect', 'trash_redirect');
function trash_redirect(){
if (is_404()){
global $wp_query, $wpdb;
@chrisguitarguy
chrisguitarguy / remove-feeds.php
Created March 28, 2012 04:37
Remove all feeds from WordPress
<?php
/*
Plugin Name: Remove All Feeds [for WPSE33072]
Description: Remove all feeds from WordPress
Author: Christopher Davis
Author URI: http://christopherdavis.me
License: GPL2
*/