3

My script accesses an api to populate posts. I can add any errors to the WP_Error class, but can I add success messages to a global variable?

1

you could test for the absence of an error and then display a success message

if(!is_wp_error( $thing )) echo "yay!!";
  • 1
    If you use print you can shorten it to: ! is_wp_error( $foo ) and print 'win!'; :) – fuxia Feb 27 '12 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.