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_filter( | |
'register_post_type_args', | |
function ($args, $postType) { | |
if ('attachment' === $postType) { | |
$args['capabilities']['edit_posts'] = 'upload_files'; | |
$args['capabilities']['upload_files'] = 'upload_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
while IFS=, read orig new; do wp --skip-themes --skip-plugins search-replace "$orig" "$new" wp_posts --include-columns=post_content --verbose; done < example.csv |
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
/dist export-ignore | |
/test export-ignore | |
/docs export-ignore | |
.gitignore export-ignore | |
.gitattributes export-ignore |
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_filter('dashboard_recent_posts_query_args', function(array $queryArgs) { | |
$postTypes = get_post_types([ | |
'public' => true, | |
'capability_type' => 'post', | |
]); | |
if (is_array($postTypes)) { | |
$queryArgs['post_type'] = $postTypes; |
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 | |
/** | |
* Recursively takes the specified criteria and adds too the expression. | |
* | |
* The criteria is defined in an array notation where each item in the list | |
* represents a comparison <fieldName, operator, value>. The operator maps to | |
* comparison methods located in ExpressionBuilder. The key in the array can | |
* be used to identify grouping of comparisons. | |
* |
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 | |
$hosts = []; | |
$doc = new DOMDocument(); | |
$doc->loadHTMLFile("report-2015.html"); | |
$historyTable = $doc->getElementById('history'); | |
$historyTableRows = $historyTable->getElementsByTagName('tr'); |
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 | |
if ( ! did_action( 'bbp_after_setup_actions' ) ) { | |
add_action( 'bbp_after_setup_actions', 'n5n_after_bbPress_setup' ); | |
} else { | |
n5n_after_bbPress_setup(); | |
} | |
/** | |
* After bbPress Setup. |
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 | |
/** | |
* Retrieves post data given a post name, type and parent ID. | |
* | |
* @return WP_Post|NULL | |
*/ | |
function get_post_by_name( array $args ) { | |
global $wpdb; |
NewerOlder