The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Remove search and pagination from table on CPT page (4 posts)

  1. fuentism
    Posted 3 years ago #


    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;


  2. TobiasBg
    Plugin Author

    Posted 3 years ago #


    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 :-)


  3. fuentism
    Posted 3 years ago #

    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.

  4. TobiasBg
    Plugin Author

    Posted 3 years ago #


    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 :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TablePress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic