WordPress Custom Post Type AJAX Search

10,640

10

3

Introduction: 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)

Be the First to Share

    Recommendations

    • Baking Contest

      Baking Contest
    • Anything Goes Contest

      Anything Goes Contest
    • Organization Challenge

      Organization Challenge

    3 Comments

    0
    mwhiteley16
    mwhiteley16

    4 years 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
    nayanmoni
    nayanmoni

    Question 4 years 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
    amberrayh
    amberrayh

    7 years ago on Introduction

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