ns-rx / poetwp

0 stars 0 forks source link

Unslash values #28

Open ns-rx opened 3 months ago

ns-rx commented 3 months ago
          If I entered `09/04/1984` as the date (i.e. it contains slashes), then this bit might get a bit mangled. By default, WordPress will add slashes to superglobal values, so you need to unslash them before sanitizing them:
        update_post_meta( $post_id, 'poem_date', sanitize_text_field( wp_unslash( $_POST['poem_date'] ) ) );

Otherwise, the displayed value may end up as 09//04//1984 etc.

_Originally posted by @GaryJones in https://github.com/ns-rx/poetwp/pull/13#discussion_r1730398196_

ns-rx commented 3 months ago

Also https://github.com/ns-rx/poetwp/pull/13#discussion_r1730398298