How can I add data to a custom column in the Users section of the wordpress backend?

manage_users_custom_column is a filter hook, so you should use add_filter() and not add_action(). Which also means you should return the output instead of echoing it. The column name is the second parameter and not the first one — which is the current value for the current column. So try with: function last_name_value($output, $column_name, $user_id) { … Read more

Get random row from custom table

[Note: @marwyk87 posted his answer while I was composing this, which represents another way to fix the problem] You’ve got a simple syntax error in your SQL, because of the way you’re referencing the table name. You should just say $sql = $wpdb->prepare( ” SELECT * FROM {$wpdb->prefix}quotes ORDER BY RAND() LIMIT 1 “); and … Read more

Tablepress won’t update the table data [closed]

TablePress is simply a plugin that allows you to create tables without coding. You can upload a CSV, sure, but once it’s uploaded, if you want the data to reflect the source CSV, you’ll have to upload the updated CSV to that specific table in TablePress again. Fortunately, TablePress makes this pretty easy with its … Read more

Add table controls with wp_editor minimal editor configuration (‘teeny’)

Finally got it running with few pieces of extra buttons too :): <?php $tinymce_options = array(‘plugins’ => “table,lists,link,textcolor,hr”, ‘toolbar1’=>”fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,alignright,alignjustify”,’toolbar2’=>”blockquote,hr,table,bullist,numlist,undo,redo,link,unlink”); $editor_config= array(‘teeny’=>true, ‘textarea_rows’=>5, ‘editor_class’=>’csec_text’, ‘textarea_name’=>’csec_text’, ‘wpautop’=>false, ‘tinymce’=>$tinymce_options); wp_editor($content, $id, $editor_config); ?> Check: wp_editor in add_meta_boxes does not show gallery for better option working in accordance with WordPress.

Get multiple db prefix with $wpdb

Write a function that uses $wpdb->prefix as a fallback. Something like this: function wpse65880_table_with_prefix($table) { // should define array in config file, rather than hard coding $my_tables = array(“table1”, “table2”, “table3”, “table4”); if (in_array($table, $my_tables)) { // “qa_” should also be a config file setting return “qa_” . $table; } else return $wpdb->prefix . $table; … Read more