What’s It do?
This snippet will allow you to create persistent & updateable custom admin notifications for select Child Sites & keep the connection so that they may be updated on the fly.
MainWP allows you to block all pages that are on the Front-End, however this doesn’t mean that we can not tap into this in order to send out custom admin notices at will to any Child Site connected to our MainWP Dashboard.
How to do it?
We will be utilizing the WP-json API that is already built into each WP website.
wp-json URL: https://YOUR-MAINWP-DASHBOARD.com/wp-json/wp/v2/pages/XX
-
Replace
YOUR-MAINWP-DASHBOARD.com
and theXX
with your page #.
( The page # can be found within the address bar when editing the page ) -
Then replace
INSERT_URL_HERE
with this custom URL in the snippet below.
Steps to setup
- Click “Go To WP Admin” button in MainWP Dashboard
- Create a new page that contains the content of your notification
- Make note of the page # & build your wp-json URL
- Replace URL
- Save & Execute on selected Child Site.
Snippet Type
Execute on Child Sites
Snippet
GRAB SNIPPET HERE
Resources: admin_notices | Hook | WordPress Developer Resources