Saturday, June 18, 2022
HomeWordPress Developmentshortcode - Including customized kind inside add_shortcode

shortcode – Including customized kind inside add_shortcode


I am including a customized kind inside a shortcode, however every time I paste the shortcode within the web page editor the shape posts routinely and redirects to /wp-admin/admin-post.php with a clean display screen.

I am utilizing the admin_post hook to submit the shape.

However once I add the shape utilizing the_content hook it really works excellent. The one downside with this technique is that I haven’t got full management of the place so as to add the shape within the web page.

What am I doing unsuitable?

// ADD THE SHORTCODE FORM
add_shortcode('get_job_card_form', 'vision_get_job_card_form');
operate vision_get_job_card_form()
{
    $formHtml="<kind motion="" . admin_url('admin-post.php') . '" technique="POST">';
    $formHtml .= wp_nonce_field('get_job_card', 'get_job_card_nonce');
    $formHtml .= ' <enter kind="hidden" title="motion" worth="get_job_card" />';
    $formHtml .= '<button title="getJobCard" kind="submit" class="et_pb_button et_pb_button_2 et_pb_bg_layout_light">Get Job Card</button>';
    $formHtml .= '</kind>';
    return $formHtml;
}

// ADMIN POST HOOK
add_action('admin_post_nopriv_get_job_card', 'get_job_card');
add_action('admin_post_get_job_card', 'get_job_card');
operate get_job_card()
{
    embody get_stylesheet_directory() . '/imaginative and prescient/knowledge/vision-get-job-card.php';
    die();
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments