Showing messages conditionally on a page based on a query param

By: Shawn Fawcett | Asked: 06/19/2022
ForumsCategory: General questionsShowing messages conditionally on a page based on a query param
Shawn Fawcett asked 2 years ago
I have a form where after submitted it redirects to another page. I would like to have a message at the top of the new page based on the query param generated by the form. How could I conditionally insert a message at the top of my page? Example for params: /admin-dashboard/?QRAssigned=123&success=yes   On the page something like this: If query parm success=yes then "Congrats! you just assigned QR 123" endif  
Shawn Fawcett replied 2 years ago

I was thinking of storing a bunch of messages in entries then pulling them up via a view. Ideally a person could click on an x and make the message disappear. Sort of like for certain plugins they add messages to the top of the admin area.

1 Answers
Victor Font answered 2 years ago
This approach will work, especially with the new Visual Views (which are awesome!). You can also create a custom shortcode to display what you want, but using a view will be easier.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right