Skip to content

Instantly share code, notes, and snippets.

View smeric's full-sized avatar

Sébastien Méric smeric

View GitHub Profile
westonruter / wp-42573.php
Last active June 14, 2024 18:17
WP Trac #42573: Fix for theme template caching.
* Plugin name: WP Trac #42573: Fix for theme template file caching.
* Description: Flush the theme file cache each time the admin screens are loaded which uses the file list.
* Plugin URI:
* Author: Weston Ruter, XWP.
* Author URI:
function wp_42573_fix_template_caching( WP_Screen $current_screen ) {
noelboss /
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like or and pull or export it to a production server. Or you use a service like to act upon a Web-Hook that's triggered that service.

DomenicF / get_current_post_type.php
Last active December 5, 2022 07:11 — forked from bradvin/get_current_post_type.php
Get the current post_type context in the WordPress admin.
* gets the current post type in the WordPress Admin
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type ) {
return $post->post_type;
gfazioli / old_version_event.js
Last active March 31, 2020 21:51
WordPress: Actions & Filters in Javascript
* This is the old version build by jQuery trigger event.
if ( typeof window.wpdk_add_action === 'undefined' ) {
herewithme / sanitize-filename.php
Created November 29, 2013 11:15
WordPress - No french punctuation and accents for filename
Plugin Name: No french punctuation and accents for filename
Description: Remove all french punctuation and accents from the filename of upload for client limitation (Safari Mac/IOS)
Plugin URI:
Version: 1.0
Author: BeAPI
Author URI:
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
joncave / plugin.php
Last active September 21, 2023 17:50
An intentionally vulnerable plugin developed for WordPress plugin author education.
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI:
* Author: Jon Cave
* Author URI:
* License: GPLv2+
ohaal / find_relative_path.func.php
Created June 15, 2012 11:47
Find the relative path between two paths
* Find the relative file system path between two file system paths
* @param string $frompath Path to start from
* @param string $topath Path we want to end up in
* @return string Path leading from $frompath to $topath
function find_relative_path ( $frompath, $topath ) {
franz-josef-kaiser / example_post_status.php
Created June 14, 2012 13:07
Add a custom post status for WP (custom) post types
// No, Thanks. Direct file access forbidden.
! defined( 'ABSPATH' ) AND exit;
add_action( 'after_setup_theme', array( 'unavailable_post_status', 'init' ) );
class unavailable_post_status extends wp_custom_post_status
peteboere / jquery.alterclass.js
Created December 24, 2011 12:49
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
* jQuery alterClass plugin
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
* Copyright (c) 2011 Pete Boere (
* Free under terms of the MIT license: