Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This gist will create a persistent WP admin notice.
add_filter( 'admin_notices', 'my_remote_admin_notice' );
add_filter( 'network_admin_notices', 'my_remote_admin_notice' );
function my_remote_admin_notice() {
$notice_url = 'INSERT_URL_HERE';
$message = json_decode( wp_remote_retrieve_body( wp_remote_get( $notice_url ) ), true)['content']['rendered'];
if( is_wp_error( $message ) ) {
return false;
}
?>
<div class="notice notice-success is-dismissible admin-notice-remote">
<div class="notice-content">
<?php echo $message; ?>
</div>
<button type="button" class="notice-dismiss">
<span class="screen-reader-text">Dismiss this notice.</span>
</button>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment