I have a WordPress search form which accepts a number of arguments such as role, credentials, state, etc.

When the search button is pressed I am successfully sent to the search results page, but am unable to get any actual results to show. Instead I am shown a 404 page. What am I missing here?

Search Form

 <form id="genealogist-search-form" method="get" action="genealogist-search-query.php">
    <table>
        <tr>
            <th>Name</th>
            <td>
                <input type="text" name="name" value="">
            </td>
        </tr>
        <tr>
            <th>Organization</th>
            <td>
                <input type="text" name="organization" value="" >
            </td>
        </tr>
        <tr>
            <th>Address</th>
            <td>
                <input type="text" name="address" value="">
            </td>
        </tr>
        <tr>
            <th>Credentials</th>
            <td>
                <select name="credentials" value="">
                    <option value="AG">AG</option>
                    <option value="CG">CG</option>
                    <option value="CGL">CGL</option>
                </select>
            </td>
        </tr>
        <tr>
            <th>State/Prov</th>
            <td>
                <input type="text" name="state_prov">
            </td>
        </tr>
<input type="submit" id="genealogist-search" name="genealogist-submit" value="Search Genealogists">
 </form>

genealogist-search-query.php

<?php 

$args = array(
    'role' => 'judge'
);

// Custom query.
$my_user_query = new WP_User_Query( $args );

// Get query results.
$editors = $my_user_query->get_results();

// Check for editors
if ( ! empty( $editors ) ) {

    echo '<ul class="editors-list">';

        // Loop over editors.
        foreach ( $editors as $editor ) {

            // Get each editor's data.
            $editor_info = get_userdata( $editor->ID );

            // Show editor's name.
            echo '<li>' . $editor_info->display_name . '</li>';

        }

    echo '</ul>';

} else {

    // Display "no editors found" message.
    echo __( 'No editors found!', 'tutsplus' );

}

?>

Read more here: WordPress Users Query


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: