Submitting form via admin-post.php and handling errors

Am I supposed to just do normal redirects back to my form page? Something like wp_redirect( ‘/my-page/’, 302 );? Yes. How do I display my errors on the page that has the form? Well, there are various ways, including: Passing an error code as a query string in the redirect URL: example.com/my-page/?my_form_error=tos_agree_empty. Then in your … Read more

Keep salts when moving a site?

You should change them. Its good practice to periodically change your wordpress salts. It will not affect the passwords in the database but it will log out all users.

WordPress php error after editing file with FileZilla

It could be a problem with your file encoding. Make sure that your files are encoded in the same way as your wordpress install. In most cases your site use files encoded in UTF-8. Go to FileZilla options: Open Site Manager > Charset tab – Custom Encoding > and see if it’s UTF-8. When it’s … Read more

What’s the proper way to use wp_enqueue_script/style?

Do this at the head of your functions.php: define(‘PATH_TO_URL’, get_bloginfo(‘template_url’) . [path to your libraries, etc.]); Then, just call wp_enqueue_script(‘script’, PATH_TO_URL . ‘myscript.js’); or similar anywhere you want. If you change the location, just change the define() and it’ll update everywhere. Easy peasy.