WordPress Custom Post Type AJAX Search

This is a 5 part tutorial explaining how to do a Custom Post Type AJAX Search.

Step 1: Setup

Step 2: Creating User Interface (PHP / HTML)

Step 3: JQuery (JS)

Step 4: AJAX Callback With JSON (PHP)

Step 5: Connect Frontend With Backend (JS)

Share

    Recommendations

    • Paint Challenge

      Paint Challenge
    • Games Contest

      Games Contest
    • Classroom Science Contest

      Classroom Science Contest

    3 Discussions

    0
    None
    mwhiteley16

    6 months ago

    Really great tutorial. One note...make sure to add dataType : 'json' to the success response if you aren't using the plugin you mentioned to render json object automatically or it returns an array instead of an object. Great stuff!

    0
    None
    nayanmoni

    Question 8 months ago on Step 1

    I can't fetch the Custom field value dynamically.
    $bed = 0;
    if(isset($_GET['bed']))
    $bed = sanitize_text_field($_GET['bed']);
    $bath = 0;
    if(isset($_GET['bath']))
    $bath = sanitize_text_field($_GET['bath']);



    This code is not working for me. Please give me the solution.

    0
    None
    amberrayh

    4 years ago on Introduction

    Thanks for sharing these video tutorials. I hope we see more from you in the future!