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
// create the iFrame | |
var iFrame = document.createElement('iframe'); | |
// set iFrame's source | |
iFrame.src = "javascript:false"; // add some URL here | |
// inject iFrame into current (parent) doc before first script tag | |
var where = document.getElementsByTagName('script')[0]; | |
where.parentNode.insertBefore(iFrame, where); |
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 | |
/* | |
* This will prevent data from being stored in WordPress' core meta tables where a custom database table has been set up instead. | |
* This will not affect meta data that does not have a custom database table – that meta data will be stored as usual. | |
*/ | |
add_filter('acfcdt/settings/bypass_post_meta_table', '__return_true'); | |
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
{ | |
"name": "{custom_database_table_name}", | |
"relationship": "{post_type}", | |
"columns": [ | |
"{acf_field_name_1}", | |
"{acf_field_name_1}", | |
"{acf_field_name_3}" | |
] | |
} |
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
{ | |
"name": "post_metadata", | |
"columns": [ | |
"post_layout", | |
"read_time", | |
"show_stats" | |
] | |
} | |
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
{ | |
"name": "page_metadata", | |
"relationship": "page", | |
"columns": [ | |
"show_page_banner", | |
"page_layout", | |
"read_time" | |
] | |
} |
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
{ | |
"name": "user_metadata", | |
"relationship": "user", | |
"columns": [ | |
"profession", | |
"age", | |
"sex", | |
"is_member", | |
"instagram_url" | |
] |
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
# Lists revision post IDs and their meta data count in descending order | |
SELECT post_id, count(*) AS count FROM wp_postmeta LEFT JOIN wp_posts ON post_id = ID WHERE post_type = 'revision' GROUP BY post_id ORDER BY count DESC; | |
# Tells you how many (total figure) meta rows belong to revision posts | |
SELECT count(*) as total_revision_meta FROM wp_postmeta INNER JOIN wp_posts ON post_id = ID WHERE post_type = 'revision'; | |
# Lists the post_id number of revisions for posts in descending order by number of revisions | |
SELECT post_parent as post_id, count(*) AS n_revisions FROM wp_posts WHERE post_type = 'revision' GROUP BY post_parent ORDER BY n_revisions DESC; | |
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 | |
/** | |
* Class BenchMarker | |
* @author Phil Kurth <phil@philkurth.com.au> | |
* | |
* A simple benchmarking utility. Easiest way to use this: | |
* | |
* BenchMarker::start(); | |
* | |
* … run stuff here … |
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
SELECT count(DISTINCT txns.user_id) | |
FROM ( | |
SELECT | |
user_id, | |
min(created_at) AS first_txn_created_at | |
FROM wp_mepr_transactions | |
WHERE status IN ('complete', 'confirmed') | |
GROUP BY user_id | |
) AS first_txns | |
INNER JOIN wp_mepr_transactions AS txns |
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 | |
/** | |
* Really simple GET request | |
*/ | |
add_action( 'rest_api_init', function ( WP_REST_Server $wp_rest_server ) { | |
register_rest_route( '/custom-namespace/v1', '/no-param', [ | |
'methods' => 'GET', | |
'callback' => function ( WP_REST_Request $request ) { | |
if ( $throw_error = false ) { |