Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User →
- Make sure your
Local by FlyWheel
WordPress install is a custom install
Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User →
Local by FlyWheel
WordPress install is a custom installWhen you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:
<?php | |
function my_acf_save_post_searchwp( $post_id ) { | |
// re-index the post | |
SWP()->purge_post( absint( $post_id ) ); | |
SWP()->trigger_index(); | |
// For some reason the above doesn't work unless there is some sort of output below it?? | |
// The js can be any arbitrary even an alert, which causes an error with acf's redirect function | |
// but still updates the searchwp index | |
// Without the code below, the post is purged - i.e. the old meta is not found, but the new meta |