/indexer/row
This filter is called before a row is inserted into the index table.
It allows to modifies properties of a row like the facet_value
and facet_name
This filter should not be used to query a facet value but simply used to modify it (like formatting a date). To setup rows and facet values you should use the filter wp_grid_builder/indexer/index_object
Argument | Type | Description |
$row | array | Holds index row of the current object id |
$object_id | integer | Post, term or user id to index |
$facet | array | Holds facet settings |
[pastacode lang=”php” manual=”function%20prefix_row_data(%20%24row%2C%20%24object_id%2C%20%24facet%20)%20%7B%20%0A%0A%0A%09%2F%2F%20We%20only%20process%20date%20facet%20type.%0A%09if%20(%20’date’%20!%3D%3D%20%24facet%5B’type’%5D%20)%20%7B%0A%09%09return%20%24row%3B%20%0A%09%7D%20%0A%0A%0A%0A%09%2F%2F%20We%20change%20the%20date%20format%20to%20match%20date%20facet%20format%20(Y-m-d%20or%20Y-m-d%20h%3Ai%3As).%20%0A%09%24row%5B’facet_value’%5D%20%3D%20date(%20’Y-m-d’%2C%20strtotime(%20%24row%5B’facet_value’%5D%20)%20)%3B%20%0A%09%2F%2F%20Return%20row%20to%20insert%20in%20the%20index%20table.%20%0A%09return%20%24row%3B%0A%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Findexer%2Frow’%2C%20’prefix_row_data’%2C%2010%2C%203%20)%3B” message=”” highlight=”” provider=”manual”/]