Skip to content

Instantly share code, notes, and snippets.

Paul Biron pbiron

Block or report user

Report or block pbiron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View enable-disable-plugins-when-doing-local-dev.php
Plugin Name: Enable/Disable plugins when doing local dev
Plugin URL:
Description: If the WP_LOCAL_DEV constant is true, enables/disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Paul V. Biron/Sparrow Hawk Computing
Author URI:
pbiron / MediaEditBackupSizes.php
Last active Jun 7, 2018
proposed WP unit tests for testing `_wp_attachment_backup_sizes` meta for ajax media editing
View MediaEditBackupSizes.php
* Admin ajax functions to be tested
require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
* Testing `_wp_attachment_backup_sizes` meta for ajax media editing
* Does NOT test that the edits made are correct
pbiron / shc_responsive_images.php
Created May 19, 2018
partial solution to WP responsive images
View shc_responsive_images.php
* full version of code I added in a comment on about how
* make it easier for WP to produce responsive images
* @link
* Note: I make no claims that this handles all cases, just those problems
* identified by others commenting on the OP's code
pbiron / shc_attachment_url_to_postid_filter.php
Last active Aug 16, 2018
func to hook into WP's attachment_url_to_postid filter to try to resolve attachment URLs for intermediate/backup sizes
View shc_attachment_url_to_postid_filter.php
if ( version_compare( get_bloginfo( 'version' ), '4.2', '>=') ) :
* WP 4.0 introduced attachment_url_to_postid(). However, it fails when the
* URL is for an intermediate sized image (e.g., `.../filename-150x150.jpg`).
* WP 4.2.0 introduced the attachment_url_to_postid filter. The filter func
* defined below hooks into that filter and attempts remedy that limitation.
add_filter( 'attachment_url_to_postid' , 'shc_attachment_url_to_postid_filter', 10, 2 );
pbiron / test-well-formed.php
Last active Jul 12, 2017
WP unit test for export redux plugin
View test-well-formed.php
require_once dirname( __FILE__ ) . '/base.php';
// the path on this to the main export code in the export redux plugin
// if/when testing the export in core, modify this path
require_once __DIR__ . '/../includes/export.php';
* @group export
pbiron / base.php
Last active Jul 12, 2017
base class for WP export unit tests
View base.php
abstract class WXR_Export_UnitTestCase extends WP_UnitTestCase {
protected function _export_wp( $args ) {
export_wp( $args );
$wxr = ob_get_contents();
You can’t perform that action at this time.