I have successfully created a wp-LINKS-list-table that displays the output of WP's core "Links" table in the WP Dashboard, and I have it displaying on a menu page I created. Step 1 accomplished!

But now I would like to be able to have the single row edit/delete (database) functionality just like the Links page. Right now I can edit/delete the links, but it's just adding/removing items from the actual links database table. I'm assuming that I not only have to create a different database table for my own queries, but I need to process my pages outside of the WordPress core as well. Right?

Or is there a core WP functionality that I can use to edit/delete my own table items?


Wordpress allows you to use a class called wpdb

Here is an example of how you would use it
function add_to_db() {
global $wpdb;
$your_table_name = $wpdb->prefix . "wp-LINKS-list-table";
$the_value = '123';
$wpdb->insert( $your_table_name, array('column_name' => $the_value,));

this will insert 123 into the column_name. You can read more here

Note: If you are creating a menu page that reflects the tables similar to the wordpress tables there is another class you can use to help you. It is called WP_List_Table I would suggest reading that and getting the Custom List Table Example Plugin it is very helpful showing examples of using WP_List_Table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.