Last active
April 13, 2022 15:36
-
-
Save hearvox/6c08c55e962663293ae23a13ab41a0e0 to your computer and use it in GitHub Desktop.
WordPress notes, admin URLs,, etc.
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 settings list (serialized data hidden): | |
/wp-admin/options.php | |
Jetpack settings by modules (defualt hidden): | |
/wp-admin/admin.php?page=jetpack_modules | |
List Reusable Blocks (CPT): | |
/wp-admin/edit.php?post_type=wp_block | |
*/ | |
/* List all PDFs in Media Library */ | |
$query_images_args = array( | |
'post_type' => 'attachment', | |
'post_status' => 'inherit', | |
'post_mime_type' => 'application/pdf', | |
'posts_per_page' => -1, | |
); | |
$query_images = new WP_Query( $query_images_args ); | |
// print_r( wp_list_pluck( $query_images->posts, 'guid' ) ); | |
wp_reset_postdata(); | |
/* Lists Pages and their assigned Page Templates */ | |
$pgs = get_pages(); | |
echo "<table style='border-spacing:5px;'><thead>\n"; | |
echo "<th><strong>Page Title (ID#)</strong></th><th><strong>Parent#</strong></th><th><strong>Template</strong></th>"; | |
echo "\n</thead><tbody><tr><colspan='3'><hr /></td></tr>\n"; | |
foreach ($pgs as $pg) { | |
$pad = ''; | |
$parent_id = $pg->post_parent; | |
if ( $parent_id ) { // Child. | |
$pad = '– '; | |
if ( get_post_ancestors( $parent_id ) ) // Grandchiid. | |
$pad = '–– '; | |
} | |
$template = get_post_meta($pg->ID, '_wp_page_template', true); | |
echo "<tr><td>$pad $pg->post_title ($pg->ID)</td><td>$parent_id</td><td>$template</td></tr>\n"; | |
} | |
echo '</tbody></table>'; | |
wp_reset_postdata(); | |
?> | |
<?php | |
// WP tool: Repair and Optimize Database | |
// Add to wp-config: | |
define('WP_ALLOW_REPAIR', true); | |
// run: /wp-admin/maint/repair.php | |
?> | |
<!-- | |
Performance metrics | |
<?php echo get_num_queries(); ?> queries | |
<?php timer_stop( 1 ); ?> seconds | |
<?php echo round( memory_get_peak_usage() / 1024 / 1024, 3 ); ?> MB Peak Memory Used | |
--> | |
<!-- Theme template: <?php global $template; print_r($template); ?> --> | |
/* Display data (for dev work) */ | |
<?php if ( current_user_can( 'administrator' ) ) { ?> | |
<details><summary>Data</summary> | |
<pre><?php print_r ( $data_array ); ?></pre> | |
</details> | |
<?php } ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment