Is it possible to set default values for custom fields in a custom post type while my plugin is being activated?

you can do that on a save_post_ hook try that : add_action(“save_post_” . CUSTOM_POST_TYPE, function ($post_ID, \WP_Post $post, $update) { if (!$update) { update_post_meta($post->ID, “cx_number”, “default value”); return; } if (isset($_POST[“cx_number”])) { update_post_meta($post->ID, “cx_number”, $_POST[“cx_number”]); } }, 10, 3);

get_option issues

I have found the solution on another forum but if someone has the same problem than me here’s the solution : For theme options modified through the $wp_customize, use get_theme_mod() instead of get_option() to retrieve the value.

Custom column under All Users (multisite network admin)?

This is all you need to add a column to the network users table, put it before a chosen column, and add data to it. add_filter( ‘wpmu_users_columns’, ‘my_awesome_new_column’ ); add_action( ‘manage_users_custom_column’, ‘my_awesome_column_data’, 10, 3 ); // Creates a new column in the network users table and puts it before a chosen column function my_awesome_new_column( $columns … Read more

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