Skip to content

Instantly share code, notes, and snippets.

@fertek
Created April 30, 2020 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fertek/fd66d621405773a1029331dc80d255ab to your computer and use it in GitHub Desktop.
Save fertek/fd66d621405773a1029331dc80d255ab to your computer and use it in GitHub Desktop.
function jf_additional_post_processing( $processed_site_dir ) {
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
$processed_site_dir,
RecursiveDirectoryIterator::SKIP_DOTS
)
);
foreach ( $iterator as $filename => $file_object ) {
$file_contents = file_get_contents( $filename );
$rewritten_contents = str_replace(
'old',
'new',
$file_contents
);
file_put_contents( $filename, $rewritten_contents );
}
\WP2Static\WsLog::l(
'Finished my additional post-processing.'
);
}
add_action( 'wp2static_post_process_complete', 'jf_additional_post_processing', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment