Skip to content

Instantly share code, notes, and snippets.

Avatar

Dhaval Parekh dhaval-parekh

View GitHub Profile
View amp-eligible-post-type-test.php
<?php
/**
* Plugin Name: AMP eligible post type test.
* Description: Plugin to test eligible post types for AMP
* Version: 0.1
*
* @wordpress-plugin
* @author Dhaval Parekh
*/
@dhaval-parekh
dhaval-parekh / wp-cleanup.sh
Created Jul 26, 2021
Shell script to cleanup WordPress site.
View wp-cleanup.sh
#!/usr/bin/env bash
plugin_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function wp() {
wp_path=$(which wp)
php "$wp_path" $url_flag --allow-root "$@"
}
wp rewrite flush
@dhaval-parekh
dhaval-parekh / filter_input_wrapper.php
Last active Jul 26, 2021
PHP: Wrapper of filter_input()
View filter_input_wrapper.php
<?php
/**
* This method is an improved version of PHP's filter_input() and
* works well on PHP CLI as well which PHP default method does not.
* Also Provide support INPUT_REQUEST.
*
* Reference:
* - https://bugs.php.net/bug.php?id=49184
* - https://bugs.php.net/bug.php?id=54672
*