I am adding validation therefore if a publish is within a specific category, it requires certain Custom Fields to become set.
This ought to be easy connecting
admin_notices, but there's a redirect that triggers the
admin_notices callback to vanish.
OK - And So I produced a hack that utilizes the Session to keep my error message over the redirect:
function set_publish_pending($data, $postarr) add_filter('wp_place_publish_data', 'set_publish_pending',1,2) function session_admin_notice() return false add_action('admin_notices', "session_admin_notice")
The issue with this particular option would be that somethe way the session isn't available when calling
session_admin_notice, that has a simple (but crazy) solution:
public static function fix_session_baloney() amplifier&lifier $_COOKIE["PHPSESSID"]) add_action('admin_init', 'fix_session_bs')
Now you ask ,: Why must i undergo all of this craziness to throw a mistake message?
What am I doing wrong?
Wordpress does not use periods, and when
register_globals is onto it will obvious the
Wordpress passes it's messages along utilizing a
message integer within the URL, a range of messages will be defined within the relevant
edit-[type]-form.php file within the
wordpress-admin folder. I believe you can most likely append your personal variable towards the redirect after which have that inside your
admin_notices hook function. Have a look in the
edit-[type]-form.php files to obtain a concept of how this may work.
if($out = $_SESSION['admin_notices'])
This problem is definitely TRUE therefore it always totally reset your $_SESSION['admin_notices'] var