Last active
March 30, 2023 07:34
-
-
Save patrickposner/b28853822eb164d2a4e9999774934224 to your computer and use it in GitHub Desktop.
Simply Static: Export all pages with shortcode in Single Export
This file contains hidden or 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( 'ssp_single_export_additional_urls', function ( $related_urls ) { | |
global $wpdb; | |
// Get all pages that have a recent posts shortcode. | |
$page_ids = $wpdb->get_row( "SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%[recent_posts AND post_type='page'", ARRAY_A ); | |
foreach ( $page_ids as $id ) { | |
$related_urls[] = get_permalink( $id ); | |
return $related_urls; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems to me the return statement should be outside the foreach loop.