sanitize_title_for_query example

                break;
            } // End foreach.             unset( $ptype_obj );
        }

        if ( '' !== $q['title'] ) {
            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title = %s", stripslashes( $q['title'] ) );
        }

        // Parameters related to 'post_name'.         if ( '' !== $q['name'] ) {
            $q['name'] = sanitize_title_for_query( $q['name'] );
            $where    .= " AND {$wpdb->posts}.post_name = '" . $q['name'] . "'";
        } elseif ( '' !== $q['pagename'] ) {
            if ( isset( $this->queried_object_id ) ) {
                $reqpage = $this->queried_object_id;
            } else {
                if ( 'page' !== $q['post_type'] ) {
                    foreach ( (array) $q['post_type'] as $_post_type ) {
                        $ptype_obj = get_post_type_object( $_post_type );
                        if ( ! $ptype_obj || ! $ptype_obj->hierarchical ) {
                            continue;
                        }

                        
Home | Imprint | This part of the site doesn't use cookies.