Overview: Filter Criteria in Views

With filters, we can define query conditions and refine the results of a view. But what is a filter and how do filters work in Views? In this tutorial, you’ll learn:

  • How to add and configure filter criteria to a view to refine results
  • What configuration options are available for filter criteria operators
  • How filter groups allow you to group and order filter criteria to achieve desired results

By the end of this lesson, you should understand how to use and configure filter criteria in Views to refine the results of your view. (Note: We’ll cover exposed filters in Overview: Exposed Filter Criteria in Views)

Goal

  • Understand how you can refine the results of your view by adding and configuring filter criteria and filter groups through the Views UI.

Prerequisites

Examples and screenshots in this tutorial are from the demo site we set up in:

If you are new to Views, check out these Drupal User Guide tutorials:

Explore filter criteria in Views UI

The Filter Criteria section of the Views UI contains all filter criteria that added to your view. Filters allow you to refine the results of your view by adding conditions to the query that you’re building using Views UI.

To add a condition to your query, add a filter and configure an operator and value. Each time you add a filter, you refine the results of your view. Your list will contain data that matches the conditions defined through filter criteria.

If you are familiar with MySQL, it may be helpful to know that filter criteria are the WHERE clause of the query that Views builds.

On the edit screen for a view, the Filter Criteria section appears beneath the Fields section and above the Sort Criteria section.

Screenshot of view edit page with filter criteria section highlighted

Every field added to our content types, users, or other entities is available to add as a filter criteria to a view (most of the time). To illustrate, here is a side-by-side comparison of the fields added to our demo site’s Baseball Player content type next to a list of available filter criteria in this content view.

Screenshot of list of fields on Baseball Player content type shown beside a list of filters available with some of the Baseball Player fields shown

Configuration options for filters

Filter criteria have two main configurable options:

  • Value: The value to use in the field table lookup
  • Operator: The method of comparison used in the field table lookup

Here is an example of a filter criteria configuration. The filter criteria shown below would limit our list of content to show content where the value of the field_player_height field is less than or equal to 50 (inches).

Screenshot of simple text filter configuration form

Here is another example of a filter criteria configuration. In this example, the filter criteria would limit our list to show content that belongs to the content type, Player.

Screenshot of a list filter configuration form

Expose this filter?

Another option for configuring a filter criterion is to expose the filter. This means that the user can use a form to change the filter values and refine the list for themselves. See the related tutorial Expose Filter Criteria to Users in Views.

Read Comfy 1001
Read Comfy 1002
Read Comfy 1003
Read Comfy 1004
Read Comfy 1005
Read Comfy 1006
Read Comfy 1007
Read Comfy 1008
Read Comfy 1009
Read Comfy 1010
Read Comfy 1011
Read Comfy 1012
Read Comfy 1013
Read Comfy 1014
Read Comfy 1015
Read Comfy 1016
Read Comfy 1017
Read Comfy 1018
Read Comfy 1019
Read Comfy 1020
Read Comfy 1021
Read Comfy 1022
Read Comfy 1023
Read Comfy 1024
Read Comfy 1025
Read Comfy 1026
Read Comfy 1027
Read Comfy 1028
Read Comfy 1029
Read Comfy 1030
Read Comfy 1031
Read Comfy 1032
Read Comfy 1033
Read Comfy 1034
Read Comfy 1035
Read Comfy 1036
Read Comfy 1037
Read Comfy 1038
Read Comfy 1039
Read Comfy 1040
Read Comfy 1041
Read Comfy 1042
Read Comfy 1043
Read Comfy 1044
Read Comfy 1045
Read Comfy 1046
Read Comfy 1047
Read Comfy 1048
Read Comfy 1049
Read Comfy 1050
Read Comfy 1051
Read Comfy 1052
Read Comfy 1053
Read Comfy 1054
Read Comfy 1055
Read Comfy 1056
Read Comfy 1057
Read Comfy 1058
Read Comfy 1059
Read Comfy 1060
Read Comfy 1061
Read Comfy 1062
Read Comfy 1063
Read Comfy 1064
Read Comfy 1065
Read Comfy 1066
Read Comfy 1067
Read Comfy 1068
Read Comfy 1069
Read Comfy 1070
Read Comfy 1071
Read Comfy 1072
Read Comfy 1073
Read Comfy 1074
Read Comfy 1075
Read Comfy 1076
Read Comfy 1077
Read Comfy 1078
Read Comfy 1079
Read Comfy 1080
Read Comfy 1081
Read Comfy 1082
Read Comfy 1083
Read Comfy 1084
Read Comfy 1085
Read Comfy 1086
Read Comfy 1087
Read Comfy 1088
Read Comfy 1089
Read Comfy 1090
Read Comfy 1091
Read Comfy 1092
Read Comfy 1093
Read Comfy 1094
Read Comfy 1095
Read Comfy 1096
Read Comfy 1097
Read Comfy 1098
Read Comfy 1099
Read Comfy 1100
Read Comfy 1101
Read Comfy 1102
Read Comfy 1103
Read Comfy 1104
Read Comfy 1105
Read Comfy 1106
Read Comfy 1107
Read Comfy 1108
Read Comfy 1109
Read Comfy 1110
Read Comfy 1111
Read Comfy 1112
Read Comfy 1113
Read Comfy 1114
Read Comfy 1115
Read Comfy 1116
Read Comfy 1117
Read Comfy 1118
Read Comfy 1119
Read Comfy 1120
Read Comfy 1121
Read Comfy 1122
Read Comfy 1123
Read Comfy 1124
Read Comfy 1125
Read Comfy 1126
Read Comfy 1127
Read Comfy 1128
Read Comfy 1129
Read Comfy 1130
Read Comfy 1131
Read Comfy 1132
Read Comfy 1133
Read Comfy 1134
Read Comfy 1135
Read Comfy 1136
Read Comfy 1137
Read Comfy 1138
Read Comfy 1139
Read Comfy 1140
Read Comfy 1141
Read Comfy 1142
Read Comfy 1143
Read Comfy 1144
Read Comfy 1145
Read Comfy 1146
Read Comfy 1147
Read Comfy 1148
Read Comfy 1149
Read Comfy 1150
Read Comfy 1151
Read Comfy 1152
Read Comfy 1153
Read Comfy 1154
Read Comfy 1155
Read Comfy 1156
Read Comfy 1157
Read Comfy 1158
Read Comfy 1159
Read Comfy 1160
Read Comfy 1161
Read Comfy 1162
Read Comfy 1163
Read Comfy 1164
Read Comfy 1165
Read Comfy 1166
Read Comfy 1167
Read Comfy 1168
Read Comfy 1169
Read Comfy 1170
Read Comfy 1171
Read Comfy 1172
Read Comfy 1173
Read Comfy 1174
Read Comfy 1175
Read Comfy 1176
Read Comfy 1177
Read Comfy 1178
Read Comfy 1179
Read Comfy 1180
Read Comfy 1181
Read Comfy 1182
Read Comfy 1183
Read Comfy 1184
Read Comfy 1185
Read Comfy 1186
Read Comfy 1187
Read Comfy 1188
Read Comfy 1189
Read Comfy 1190
Read Comfy 1191
Read Comfy 1192
Read Comfy 1193
Read Comfy 1194
Read Comfy 1195
Read Comfy 1196
Read Comfy 1197
Read Comfy 1198
Read Comfy 1199
Read Comfy 1200
Read Comfy 1201
Read Comfy 1202
Read Comfy 1203
Read Comfy 1204
Read Comfy 1205
Read Comfy 1206
Read Comfy 1207
Read Comfy 1208
Read Comfy 1209
Read Comfy 1210
Read Comfy 1211
Read Comfy 1212
Read Comfy 1213
Read Comfy 1214
Read Comfy 1215
Read Comfy 1216
Read Comfy 1217
Read Comfy 1218
Read Comfy 1219
Read Comfy 1220
Read Comfy 1221
Read Comfy 1222
Read Comfy 1223
Read Comfy 1224
Read Comfy 1225
Read Comfy 1226
Read Comfy 1227
Read Comfy 1228
Read Comfy 1229
Read Comfy 1230
Read Comfy 1231
Read Comfy 1232
Read Comfy 1233
Read Comfy 1234
Read Comfy 1235
Read Comfy 1236
Read Comfy 1237
Read Comfy 1238
Read Comfy 1239
Read Comfy 1240
Read Comfy 1241
Read Comfy 1242
Read Comfy 1243
Read Comfy 1244
Read Comfy 1245
Read Comfy 1246
Read Comfy 1247
Read Comfy 1248
Read Comfy 1249
Read Comfy 1250
Read Comfy 1251
Read Comfy 1252
Read Comfy 1253
Read Comfy 1254
Read Comfy 1255
Read Comfy 1256
Read Comfy 1257
Read Comfy 1258
Read Comfy 1259
Read Comfy 1260
Read Comfy 1261
Read Comfy 1262
Read Comfy 1263
Read Comfy 1264
Read Comfy 1265
Read Comfy 1266
Read Comfy 1267
Read Comfy 1268
Read Comfy 1269
Read Comfy 1270
Read Comfy 1271
Read Comfy 1272
Read Comfy 1273
Read Comfy 1274
Read Comfy 1275
Read Comfy 1276
Read Comfy 1277
Read Comfy 1278
Read Comfy 1279
Read Comfy 1280
Read Comfy 1281
Read Comfy 1282
Read Comfy 1283
Read Comfy 1284
Read Comfy 1285
Read Comfy 1286
Read Comfy 1287
Read Comfy 1288
Read Comfy 1289
Read Comfy 1290
Read Comfy 1291
Read Comfy 1292
Read Comfy 1293
Read Comfy 1294
Read Comfy 1295
Read Comfy 1296
Read Comfy 1297
Read Comfy 1298
Read Comfy 1299
Read Comfy 1300
Read Comfy 1301
Read Comfy 1302
Read Comfy 1303
Read Comfy 1304
Read Comfy 1305
Read Comfy 1306
Read Comfy 1307
Read Comfy 1308
Read Comfy 1309
Read Comfy 1310
Read Comfy 1311
Read Comfy 1312
Read Comfy 1313
Read Comfy 1314
Read Comfy 1315
Read Comfy 1316
Read Comfy 1317
Read Comfy 1318
Read Comfy 1319
Read Comfy 1320
Read Comfy 1321
Read Comfy 1322
Read Comfy 1323
Read Comfy 1324
Read Comfy 1325
Read Comfy 1326
Read Comfy 1327
Read Comfy 1328
Read Comfy 1329
Read Comfy 1330
Read Comfy 1331
Read Comfy 1332
Read Comfy 1333
Read Comfy 1334
Read Comfy 1335
Read Comfy 1336
Read Comfy 1337
Read Comfy 1338
Read Comfy 1339
Read Comfy 1340
Read Comfy 1341
Read Comfy 1342
Read Comfy 1343
Read Comfy 1344
Read Comfy 1345
Read Comfy 1346
Read Comfy 1347
Read Comfy 1348
Read Comfy 1349
Read Comfy 1350
Read Comfy 1351
Read Comfy 1352
Read Comfy 1353
Read Comfy 1354
Read Comfy 1355
Read Comfy 1356
Read Comfy 1357
Read Comfy 1358
Read Comfy 1359
Read Comfy 1360
Read Comfy 1361
Read Comfy 1362
Read Comfy 1363
Read Comfy 1364
Read Comfy 1365
Read Comfy 1366
Read Comfy 1367
Read Comfy 1368
Read Comfy 1369
Read Comfy 1370
Read Comfy 1371
Read Comfy 1372
Read Comfy 1373
Read Comfy 1374
Read Comfy 1375
Read Comfy 1376
Read Comfy 1377
Read Comfy 1378
Read Comfy 1379
Read Comfy 1380
Read Comfy 1381
Read Comfy 1382
Read Comfy 1383
Read Comfy 1384
Read Comfy 1385
Read Comfy 1386
Read Comfy 1387
Read Comfy 1388
Read Comfy 1389
Read Comfy 1390
Read Comfy 1391
Read Comfy 1392
Read Comfy 1393
Read Comfy 1394
Read Comfy 1395
Read Comfy 1396
Read Comfy 1397
Read Comfy 1398
Read Comfy 1399
Read Comfy 1400
Read Comfy 1401
Read Comfy 1402
Read Comfy 1403
Read Comfy 1404
Read Comfy 1405
Read Comfy 1406
Read Comfy 1407
Read Comfy 1408
Read Comfy 1409
Read Comfy 1410
Read Comfy 1411
Read Comfy 1412
Read Comfy 1413
Read Comfy 1414
Read Comfy 1415
Read Comfy 1416
Read Comfy 1417
Read Comfy 1418
Read Comfy 1419
Read Comfy 1420
Read Comfy 1421
Read Comfy 1422
Read Comfy 1423
Read Comfy 1424
Read Comfy 1425
Read Comfy 1426
Read Comfy 1427
Read Comfy 1428
Read Comfy 1429
Read Comfy 1430
Read Comfy 1431
Read Comfy 1432
Read Comfy 1433
Read Comfy 1434
Read Comfy 1435
Read Comfy 1436
Read Comfy 1437
Read Comfy 1438
Read Comfy 1439
Read Comfy 1440
Read Comfy 1441
Read Comfy 1442
Read Comfy 1443
Read Comfy 1444
Read Comfy 1445
Read Comfy 1446
Read Comfy 1447
Read Comfy 1448
Read Comfy 1449
Read Comfy 1450
Read Comfy 1451
Read Comfy 1452
Read Comfy 1453
Read Comfy 1454
Read Comfy 1455
Read Comfy 1456
Read Comfy 1457
Read Comfy 1458
Read Comfy 1459
Read Comfy 1460
Read Comfy 1461
Read Comfy 1462
Read Comfy 1463
Read Comfy 1464
Read Comfy 1465
Read Comfy 1466
Read Comfy 1467
Read Comfy 1468
Read Comfy 1469
Read Comfy 1470
Read Comfy 1471
Read Comfy 1472
Read Comfy 1473
Read Comfy 1474
Read Comfy 1475
Read Comfy 1476
Read Comfy 1477
Read Comfy 1478
Read Comfy 1479
Read Comfy 1480
Read Comfy 1481
Read Comfy 1482
Read Comfy 1483
Read Comfy 1484
Read Comfy 1485
Read Comfy 1486
Read Comfy 1487
Read Comfy 1488
Read Comfy 1489
Read Comfy 1490
Read Comfy 1491
Read Comfy 1492
Read Comfy 1493
Read Comfy 1494
Read Comfy 1495
Read Comfy 1496
Read Comfy 1497
Read Comfy 1498
Read Comfy 1499
Read Comfy 1500