• Resolved banana828

    (@banana828)


    Hi!

    I have a pretty simple plugin with a WordPress button. I have been using the following code for a while now:

    $button_html = get_submit_button('Register', 'primary', 'submit_button_name', false, $args);
    $button_with_link = '<a href="' . get_option('events_page_registration') . '?eid=' . $row->id . '">' . $button_html . '</a>';
    echo "<p>{$button_with_link}</p>";

    It works fine in the page when I look at it from the website. But Elementor really finds this hard to do, because everytime I try to edit the page in Elementor it shows me this:

    Error 500: Click her for preview debug

    When I click in the link for preview, it shows me this:

    Uncaught Error: Call to undefined function get_submit_button() in /var/www/vhosts/HOST/DOMAIN/wp-content/plugins/PLUGIN/includes/shortcodes_event.php:139

    Which is the line that uses the get_submit_button(…).

    Why is this happening all of a sudden? I did get the shortcode inside the page, so it worked once.

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

    (@jahidhasan018)

    It seems like Elementor might not be able to recognize the get_submit_button() function. This could be due to how Elementor handles the rendering of content and interacts with WordPress functions.

    To troubleshoot, you could try replacing get_submit_button() with a standard HTML button markup and see if Elementor handles it better. Additionally, ensure that the necessary WordPress core files are being loaded properly when Elementor is active.

    If the issue persists, you may need to reach out to Elementor’s support for further assistance, as they may have insights or solutions specific to their plugin’s interaction with WordPress functions.

    Plugin Support Milos

    (@miloss84)

    Hi there,

    Please note that through this channel, we can only provide support for Elementor’s existing features and do not provide support for custom code solutions or custom plugin code, as it goes out of our support scope.

    Currently, development/custom code queries (custom widgets and functions, Theme Child, custom code and CSS, BETA testing issues, compatibility issues, etc.) have to be directed to our GitHub project, where our developers will be able to assist. Kindly note that our GitHub project is not a support channel; therefore, the response times may vary. We appreciate your understanding.

    To post on our GitHub Repository, follow this guide: Contribution Guidelines.

    I hope this helps. If I missed something, please reply if you have any further questions regarding this ticket and Elementor. I’d request that you open a new ticket for any other issue; this will allow us to give you more accurate support.

    Kind Regards,

    Thread Starter banana828

    (@banana828)

    @jahidhasan018

    Thanks for your your reply. I found a way around it; just don’t use the WordPress functionality and create a HTML button.

    $button_text = 'Register';
    $button_class = 'button-primary';
    $button_name = 'submit_button_name';
    
    // Generate button HTML
    $button_html = sprintf(
        '<button name="%s" id="%s" class="%s">%s</button>',
        esc_attr($button_name),
        esc_attr($button_name),
        esc_attr($button_class),
        esc_html($button_text)
    );
    
    $button_with_link = sprintf(
        '<a href="%s">%s</a>',
        esc_url(get_option('klc_events_page_registration') . '?eid=' . $row->id),
        $button_html
    );

    This is actually generated by ChatGPT. I guess it does give awesome solutions sometimes ??

    As Milos just pointed out, the support does not… support problems outside Element (like plugins and stuff) even though the error only exists inside Elementor. This is a common reply I get when I have problems with Elementor. I do try to avoid it as much as I can, but sometimes clients need or use it.

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