: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Filters the `get_posts()` arguments while preparing items for the forms overview table.
* @param array $args Arguments array.
$args = (array) apply_filters( 'wpforms_overview_table_prepare_items_args', $args ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
$this->items = wpforms()->get( 'form' )->get( '', $args );
$per_page = $args['posts_per_page'] ?? $this->get_items_per_page( 'wpforms_forms_per_page', $this->per_page );
$this->update_count( $args );
$count_current_view = empty( $this->count[ $this->view ] ) ? 0 : $this->count[ $this->view ];
$this->set_pagination_args(
'total_items' => $count_current_view,
'total_pages' => ceil( $count_current_view / $per_page ),
* Calculate and update form counts.
* @param array $args Get forms arguments.
private function update_count( $args ) {
* Allow counting forms filtered by a given search criteria.
* If result will not contain `all` key, count All Forms without filtering will be performed.
* @param array $count Contains counts of forms in different views.
* @param array $args Arguments of the `get_posts`.
$this->count = (array) apply_filters( 'wpforms_overview_table_update_count', [], $args ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
// We do not need to perform all forms count if we have the result already.
if ( isset( $this->count['all'] ) ) {
$this->count['all'] = wpforms_current_user_can( 'wpforms_view_others_forms' )
? (int) wp_count_posts( 'wpforms' )->publish
: (int) count_user_posts( get_current_user_id(), 'wpforms', true );
* Filters forms count data after counting all forms.
* This filter executes only if the result of `wpforms_overview_table_update_count` filter
* doesn't contain `all` key.
* @param array $count Contains counts of forms in different views.
* @param array $args Arguments of the `get_posts`.
$this->count = (array) apply_filters( 'wpforms_overview_table_update_count_all', $this->count, $args ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
* Display the pagination.
* @param string $which The location of the table pagination: 'top' or 'bottom'.
protected function pagination( $which ) {
if ( $this->has_items() ) {
parent::pagination( $which );
'<div class="tablenav-pages one-page">
<span class="displaying-num">%s</span>
esc_html__( '0 items', 'wpforms-lite' )
* Extending the `display_rows()` method in order to add hooks.
public function display_rows() {
* Fires before displaying the table rows.
* @param ListTable $list_table_obj ListTable instance.
do_action( 'wpforms_admin_overview_before_rows', $this ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
* Fires after displaying the table rows.
* @param ListTable $list_table_obj ListTable instance.
do_action( 'wpforms_admin_overview_after_rows', $this ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
* @param string $text The 'submit' button label.
* @param string $input_id ID attribute value for the search input field.
public function search_box( $text, $input_id ) {
wpforms()->get( 'forms_search' )->search_box( $text, $input_id );
* Get the list of views available on forms overview table.
protected function get_views() {
return wpforms()->get( 'forms_views' )->get_views();