Support » Plugin: TablePress » Remove search and pagination from table on CPT page

  • Resolved fuentism



    I just installed TablePress and I want to remove the search, limit dropdown and pagination information on all tables on a certain custom post type page.

    Below is what I came up with, and it seems to work ok. I didn’t see an extension for this already (may have missed it), but just posting here in case there’s a better way? OR if it can help anyone do this in the future.

    This in functions.php

    function edit_myposttype_tablepress_output ( $options ) {
    	if(  'myposttype' == get_post_type() ) {
    		$options['datatables_filter'] = 0;
    		$options['datatables_paginate'] = 0;
    		$options['datatables_info'] = 0;
    	return $options;

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg



    thanks for your post.

    Your code looks good and should work just fine. The only changes I suggest are to replace 0 with false, and maybe to not put the code into your theme’s functions.php, but into a small new plugin file, just like the other Extensions are.

    Now, I’m wondering a little bit why you are not simply unchecking the checkboxes for these features on the table’s “Edit” screen. Or are you showing the same tables in other posts/pages with the JS features enabled? Then you could also use the Shortcode parameters for this. But in the end it comes down to personal preference, and probably to the number of tables that are affected by this. For a high number, it’s probably faster to turn the features in one go with your code, so I can imagine why you are doing it this way 🙂


    Beautiful, thank you Tobias!

    Yes, exactly, I should have specified that I want to use certain tables in multiple places and on this one post type I don’t want the extras to appear.

    Also I want the folks who are adding these custom entries to just be able to use the easy-peasy TablePress button in the editor to insert a table, and I’m pretty sure they’ll forget to alter the shortcodes.

    The plugin is great and very intuitive to use btw, I’m glad I found it.

    Plugin Author TobiasBg



    no problem, you are very welcome! 🙂 Nice to hear that you like the plugin.
    For your use case, the PHP code solution is indeed the best then 🙂

    Best wishes,

    P.S.: If you haven’t yet, don’t forget to rate the plugin in the plugin directory. Thanks 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove search and pagination from table on CPT page’ is closed to new replies.