Skip to content

Instantly share code, notes, and snippets.

View gianghl1983's full-sized avatar

Giang Le gianghl1983

View GitHub Profile
@gianghl1983
gianghl1983 / WPS_Extend_Plugin.php
Created January 18, 2021 09:08 — forked from wpsmith/WPS_Extend_Plugin.php
PHP: WPS_Extend_Plugin Class designed to declare a plugin dependency and used for extending a plugin.
<?php
/**
* Contains WPS_Extend_Plugin class. and wps_extend_plugins function.
*
* @package WPS_Core
* @author Travis Smith <t@wpsmith.net>
* @copyright 2015 WP Smith, Travis Smith
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @version 1.0.0
* @since File available since Release 1.0.0
<?php
/*
Plugin Name: Import demo
Plugin URI: http://royduineveld.nl
Description: A demo import for my blog
Version: 1.0
Author: Roy Duineveld
Author URI: http://royduineveld.nl
*/
@gianghl1983
gianghl1983 / acf-change-file-upload-directory.php
Created January 23, 2021 15:39 — forked from BODA82/acf-change-file-upload-directory.php
Change the upload directory of Advanced Custom Fields file upload field.
<?php
// ACF upload prefilter
function gist_acf_upload_dir_prefilter($errors, $file, $field) {
// Only allow editors and admins, change capability as you see fit
if( !current_user_can('edit_pages') ) {
$errors[] = 'Only Editors and Administrators may upload attachments';
}
// This filter changes directory just for item being uploaded