Skip to content

Instantly share code, notes, and snippets.

@cdils
cdils / comment-notes-before.php
Last active March 4, 2022 22:37
Customize the text before the comment form in WordPress. Note: Logged in users will not see this text.
<?php //remove this line
add_filter( 'comment_form_defaults', 'cd_pre_comment_text' );
/**
* Change the text output that appears before the comment form
* Note: Logged in user will not see this text.
*
* @author Carrie Dils <http://www.carriedils.com>
* @uses comment_notes_before <http://codex.wordpress.org/Function_Reference/comment_form>
*
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active July 15, 2024 10:02
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@khromov
khromov / disable-rest-api-for-anonymous-users.php
Created October 13, 2017 15:55
Disable WordPress REST API for anonymous users
<?php
/*
Plugin Name: Disable REST API for anonymous users
*/
/**
* Remove all endpoints except SAML / oEmbed for unauthenticated users
*/
add_filter( 'rest_authentication_errors', function($result) {
if ( ! empty( $result ) ) {
@ApoGouv
ApoGouv / 00_wp-optimizations-security-n-cleanup.md
Last active December 21, 2023 10:05
WP - Optimizations, Security hardening and Cleanup.

** WP - Optimizations, Security hardening and Cleanup **

Here you can find a a list of WP optimization and cleanup functions and methodology.

1.  .htaccess
  ** Security **
- Disable the server signature
- Disable directory browsing
- Force https to your site.
@wpflames
wpflames / post-types.php
Last active December 21, 2023 18:21
Create a Custom Post Type in WordPress
<?php
function custom_post_types() {
// Events
register_post_type('event', array(
'public' => true,
'capability_type' => 'event',
'map_meta_cap' => true,
'show_in_rest' => true,
'has_archive' => true,
@uptheirons78
uptheirons78 / event-card-pattern.php
Created March 10, 2023 09:50
Register a WordPress Pattern
<?php
/**
* Title: Event Card
* Slug: text-domain/event-card
* Categories: cards
*/
?>
<!-- wp:group {"className":"specifica-opera","layout":{"type":"default"}} -->
<div class="wp-block-group specifica-opera"><!-- wp:heading {"textColor":"hc_azzurro"} -->
<h2 class="has-hc-azzurro-color has-text-color">Missa Brevis in La Maggiore BWV 234</h2>
@HashandSalt
HashandSalt / .htaccess
Created April 4, 2023 12:52
.htaccess
# Kirby .htaccess
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
RewriteCond %{HTTP_HOST} !=localhost