Please wait...

Frequently asked questions

FAQFrequently asked questions

Atttachments

How to allow my front-end users to upload attachments in front-end uploader?

By default, WordPress Media Library (used for attachments) allows file uploads only for users who have the upload_files capability. So, everyone who doesn’t have this capability (e.g. a subscriber) will receive an error on trying to upload a file.

To add this capability to subscribers you can e.g. use the User Role Editor plugin. Just enable the upload_files capability for the users which need it and it will work.

Other option is to add this capability dynamically via a hook. To do this you can add e.g. this code to your theme’s functions.php:

            function give_permissions( $allcaps, $cap, $args ) {
                $allcaps['upload_files'] = true;
                return $allcaps;
            }
            add_filter( 'user_has_cap', 'give_permissions', 0, 3 );     

Basically, it enables the upload_files capability to everyone – but you can extend this logic to allow it only for certain users at certain moments.

Permalink 0 0

How to allow logged out users to upload attachments?

By default WordPress does not allow this. Reason is: logged out user has no ID (id is 0), and no permissions/capabilities enabled for him.

A solution would be to create an actual user that will be used as a single user for all logged-out users, and copy his ID (e.g. id = 100).

Then you can add a simple hook to identify logged out users as User with ID 100. To do this you can use a hook like this:

    function set_loggedout_id( $user_id ){
       if( empty( $user_id ) ){
          $user_id = 100;
       }
       return $user_id;
    }
            
    add_filter( 'determine_current_user', 'set_loggedout_id', 999, 1 );

Basically, it “tells” WordPress to replace the empty ID of a logged out user with a value of 100.
Then you can allow uploading for this user.

Permalink 1 1

I don’t see the upload media library!

Please check if you maybe have some inline JS minifier tool enabled, e.g. W3TotalCache – inline minification of JS breaks the front-end uploader template logic.

Permalink 1 0

Filtering

How to use URL parameters for filtering?

Tables can be filtered with query string that consists of “wdtColumnFilter[KEY]” value pairs where KEY is zero based numerical index of the column you would like to filter or initial column header. E.g.

?wdt_column_filter[1]=Asia&wdt_column_filter[country]=Thailand

Values passed from URL will be used as default filter values therefore “Advanced filtering” option needs to be enabled on table edit page.

Permalink 1 0

How to filter table by invisible columns?

If you like to have invisible columns in filters, that can be achieved by enabling “Filter in form” option in table edit page.
“Filter in form” option will create filters as a separate section from the table and additionally show filters for all hidden columns.
You can choose which column filter will be visible/hidden by unchecking/checking the Add a filter for this column button in the column settings for desired column.

Permalink 3 2

Individual column filtering works, but global search doesn’t return anything. Why?

This usually happens for MySQL-based tables with server-side processing turned on.

Please check if you have a complicated query with JOINs, calculated columns (e.g. ” SELECT mycolumn*2 AS mycolumn2″), or some custom column aliases (e.g. “SELECT mycolumn AS ‘some/weird/name’). If this is the case, please either create a MySQL view (in PHPMyAdmin or similar MySQL DB manager) and build a wpDataTable based on this view.

Permalink 0 0

Front-end

I added a table but see no sorting, filtering or pagination

  • Please check first if PHP version is at least 5.4 or newer. It is required for proper running of wpDataTables.
  • Second thing to check is that there are no JS errors in the javascript console. Please check e.g. in Chrome JS console. Usually when we investigate such things we find out that some other plugin or theme are broken, and wpDataTables JS cannot execute.
  • Please try switching the theme to a different one and see if it helps.
  • Feel free to open a support ticket, providing us with the URL of the page so we could tell why does it happen.

Permalink 1 5

How to filter table by invisible columns?

If you like to have invisible columns in filters, that can be achieved by enabling “Filter in form” option in table edit page.
“Filter in form” option will create filters as a separate section from the table and additionally show filters for all hidden columns.
You can choose which column filter will be visible/hidden by unchecking/checking the Add a filter for this column button in the column settings for desired column.

Permalink 3 2

How to disable opening links in a popup?

File that is responsible for rendering link columns is /source/class.link.wpdatacolumn.php
By opening that file you can see code for creating html anchor element with attribute “target=’_blank'”.
By changing ‘_blank’ value to ‘_self’ will cause link to open in same page instead of new window.

Permalink 0 0

MySQL

Can’t connect to remote MySql database

If you are using separate MySql connection option to connect to mysql database, you can test if connection can actually be established with “Test MySQL settings” button.
If connection can’t be established, first please make sure that all entered values needed for connection are correct.
Also make sure that MySql server is allowing remote connections and that MySql user that you are trying to connect with is allowed to connect from your sites host(IP address).

Permalink 0 1

How to create MySql query that uses tables from multiple databases?

This can be achieved with adding database name in front of a table name in MySql query.
For example:
SELECT * FROM database_name1.table1_name tb1 INNER JOIN database_name2.table2_name tb2 ON tb1.field_name=tb2.field_name

Just please make sure that MySql user that your site is connecting with has the right privileges for every database in MySql query.

Permalink 0 0

Individual column filtering works, but global search doesn’t return anything. Why?

This usually happens for MySQL-based tables with server-side processing turned on.

Please check if you have a complicated query with JOINs, calculated columns (e.g. ” SELECT mycolumn*2 AS mycolumn2″), or some custom column aliases (e.g. “SELECT mycolumn AS ‘some/weird/name’). If this is the case, please either create a MySQL view (in PHPMyAdmin or similar MySQL DB manager) and build a wpDataTable based on this view.

Permalink 0 0

Table look and feel

How to make my table responsive on desktop?

Firstly “responsive” feature needs to be enabled for the table.
This can be done in wpDataTables table edit page by ticking “Responsive” checkbox in “Data source and main settings” section and saving changes.

Second step involves going to the wpDataTables Settings page and setting “Tablet width” option to large value (e.g. 2000) and saving options.

Permalink 0 1

How can I hide columns in the table?

First option would be to click on “Column settings” buttons which you can find in header of every column in “Table preview and columns setup” section.
After that Column settings modal will open and, under “Display” tab, you can find “Visible on front-end” option.

Second option would be to click on “Complete column list” button wpDataTables complete column list to open a modal where you can quickly access some column settings.
In the modal you can click on show/hide icon to toggle visibility for each column.

It is recommended that if you don’t need certain columns to remove it from data source or select query for mysql tables if possible.
It will speed up loading of the page and result in more clear look of column setup section.

Permalink 0 0

Adding text before/after column values without affecting sorting

In wpDataTables column settings for every column there are text fields “Cell content prefix” and “cell content suffix”.
Values from those text fields will be used for adding text before or/and after every cell content in a column.
This feature uses css for displaying entered text, therefore sorting of the columns will not be affected.

Permalink 2 0

How to change display date format of a date column?

Display date format of a date column can be changed in wpDataTables Settings page from “Date format” drop-down menu.

Permalink 0 1

How to change thousand and decimal separators for number columns?

This can be changed from “Number format” drop-down menu in the wpDataTables Settings page.

Permalink 1 1

How to display table column filters in header?

In order to show column filters in header “Render advanced filter” option needs to be changed to “In the header” on wpDataTables Settings page.

Permalink 3 0

How to center-align the content in table cells?

The easiest way to do this is via CSS.

If you wish to apply this code to all of your wpDataTables tables, you can put it in “Custom wpDataTables CSS” text area on wpDataTables Settings page,
or if you wish to apply it only on specific pages, you can put it in between style tags in for example html editor bellow tables short codes. E.g.

<style>
 .wpDataTablesWrapper table.wpDataTable td, .WpDataTablesWrapper table.wpDataTable th
{ text-align: center !important;}
</style>

In this example we align the text in the center of the table, you can change the text align to your desire by changed the word “center” to “left” or “right”.

Permalink 0 1

Table settings

How to display table column filters in header?

In order to show column filters in header “Render advanced filter” option needs to be changed to “In the header” on wpDataTables Settings page.

Permalink 3 0

How to show/hide table column filters?

For showing and hiding column filters is responsible “Advanced column filters ” option on the table settings page.
You can also hide each column filter in column settings by unchecking the “Add a filter for this column” button in Filtering tab for desired column.
By checking or unchecking this settings check box and saving, table will show or hide column filters.

Permalink 1 2

How to filter table by invisible columns?

If you like to have invisible columns in filters, that can be achieved by enabling “Filter in form” option in table edit page.
“Filter in form” option will create filters as a separate section from the table and additionally show filters for all hidden columns.
You can choose which column filter will be visible/hidden by unchecking/checking the Add a filter for this column button in the column settings for desired column.

Permalink 3 2

Never miss new features!

Join 2000+ newsletter subscribers

Never miss notifications about new cool features, promotions, giveaways or freebies - subscribe to our newsletter! We send about one mail per month, and do our best to keep our announcements interesting.

We never spam or disclose your address to anyone.