• Resolved Jakes

    (@johanppmedia)


    Hi there,

    We have a custom word blocker function for posts containing certain words, when creating a post from the dashboard this function is working fine. The function detects the words and displays an error on screen that user should remove the words that we highlight.

    However from the wpuf form on the front end, once the user submits the form the spinning wheel just runs endlessly without showing the error words to be fixed, how can we display these normal wordpress post errors to users on the front-end?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @johanppmedia,

    Thanks for sharing your issue.

    Could you let me know in which field you tried to restrict word content?

    Regards,

    Thread Starter Jakes

    (@johanppmedia)

    Hi there @ehsanulabrar

    Thanks for the feedback ^^

    It is the default WordPress content field: post_content

    The below should give you an indication of the error to be shown with wp_die:

    if( count( $found_words ) === 0 )
        return;
      wp_die(
        sprintf(
          __(
            'Your post contains words that we do not allow ("%s"). Please remove them and try again.',
            'jhnpp'
          ),
          implode( '", "', $found_words )

    Regards,

    • This reply was modified 3 years, 8 months ago by Jakes.

    Hi @johanppmedia,

    This could be a JavaScript issue or a fatal error when submitting the post. if WP_DEBUG is true, and there is a fatal error, the error would be found in the debug log.

    The JavaScript error can be seen by inspecting the element and going to the console tab as you can see in the screenshot: https://prnt.sc/mhGcJ80vLEiw

    Hope you understand.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Show errors in create post form’ is closed to new replies.