• Resolved fawp

    (@fawp)


    I wanted to add a Submit button on a front-end page I am building, and I’ve seen WP provides a submit_button function.

    However, when calling that function from within the code of the page, I get a

    Fatal error: Uncaught Error: Call to undefined function submit_button().

    By searching around, I have found this ticket https://core.trac.www.ads-software.com/ticket/20490 which seems to imply that the submit_button function was not really intended for use outside of the admin area, and that request was closed as wontfix.

    I have read documentation for both

    https://developer.www.ads-software.com/reference/functions/submit_button/

    and

    https://developer.www.ads-software.com/reference/functions/get_submit_button/

    but neither of these reference pages mention that these functions are not intended for use outside of the wp-admin area. The only hint that this would be the case by reading those reference pages, is that under the ‘Used By’ section you won’t find the functions used outside of the wp-admin/ folder, but it does not appear obvious.

    Assuming all of the above is correct, my thinking is that both pages should have an explicit clarification that the functions are not for front-end usage.

    Thanks,
    fawp

    • This topic was modified 5 years ago by fawp.
    • This topic was modified 5 years ago by fawp.
    • This topic was modified 5 years ago by fawp.
    • This topic was modified 5 years ago by fawp.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Hi fawp – thank you for the thoughtful suggestion. If you have not already done so, I suggest you submit an appropriate user note for the specific docs pages so this at least gets documented somewhere. Updates to principal reference doc content can be a long time in coming.

    As you likely know, you could explicitly require_once() the appropriate file in your code so the function becomes available. You would of course get all of the other functions declared there as well, which could be useful or be useless overhead. I suspect you simply output your own button HTML, which is what I would do ??

    Thread Starter fawp

    (@fawp)

    Hi bcworkz, my pleasure.

    Sure, happy to submit notes in there, I will do so now.

    Thanks for the suggestions about require_once() and HTML, I’ll probably go for the latter!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error: Uncaught Error: Call to undefined function submit_button()’ is closed to new replies.