This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
'use strict'; | |
// Used to mask behavior of input type file | |
$('.input-group-file').each(function (e, i) { | |
var inputFile = $(i).find('input[type="file"]'); | |
var inputText = $(i).find('input[type=text]'); | |
var inputLabel = $(i).find('label'); | |
// Bind click to use the label behavior in the input text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'me/favorite', 'add', array( | |
'methods' => 'GET', | |
'callback' => 'rest_test', | |
) ); | |
} ); | |
function wp_send_rest_success( $response = array() ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* To validate if user accepts terms & conditions | |
*/ | |
add_action( 'pre_jptt_user_register', function () { | |
$accept_terms = (bool) trim( filter_input( INPUT_POST, 'accept_terms', FILTER_SANITIZE_STRING ) ); | |
if ( !$accept_terms ) { | |
$error = new WP_Error( 'no_accept_terms', __( "You must accept terms & conditions to continue", TEXT_DOMAIN ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from wp_posts where post_type in ('product', 'product_variation', 'shop_order'); | |
delete from wp_postmeta where post_id not in (select ID as post_id from wp_posts); | |
delete from wp_comments where comment_post_ID not in (select ID as comment_post_ID from wp_posts); | |
delete from wp_commentmeta where comment_id not in (select comment_ID as comment_id from wp_comments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Block any attempted XML-RPC requests | |
<Files xmlrpc.php> | |
order deny,allow | |
deny from all | |
## allow from 123.123.123.123 | |
</Files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_post_type_support( 'post', 'page-attributes' ); | |
add_action( 'init', function() { | |
global $wp_post_types; | |
$wp_post_types['post']->hierarchical = true; | |
}, 99 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------------------------------- | |
# WORDPRESS HTACCESS FIREWALL | |
# @ http://codex.wordpress.org/Hardening_WordPress | |
# ---------------------------------------------------------------------- | |
# ---------------------------------------------------------------------- | |
# DISABLE DIRECTORY BROWSING | |
# ---------------------------------------------------------------------- | |
Options All -Indexes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="col-sm-6" action="<?php echo admin_url('admin-ajax.php') ?>" method="post"> | |
<?php | |
$poll = current(get_posts('post_type=poll&posts_per_page=1')); | |
$poll_options = (array) get_post_meta($poll->ID, '_poll_options', TRUE); | |
?> | |
<input type="hidden" name="poll_id" value="<?php echo $poll->ID ?>"> | |
<input type="hidden" name="action" value="user_poll_vote"> | |
<?php wp_nonce_field('user_poll_vote') ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |