First and last name fields not filled when using wp_insert_user
After wp_insert_user, you could try running update_user_meta( $new_user_id, “first_name”, $ext_user[‘firstName’] ) ;
After wp_insert_user, you could try running update_user_meta( $new_user_id, “first_name”, $ext_user[‘firstName’] ) ;
Not without touching the global $submenu directly (which I wouldn’t recommend – using only purposefully exposed APIs provides, in general, better stability). However, if you wanted a function to remove all submenus: /** * Removes all submenus of given menu item * * @param string $menu_slug The slug of the parent menu to remove submenus … Read more
Change ma_admin_options_init() to: public function ma_admin_options_init(){ register_setting(‘ma_admin_styler’, ‘ma_admin_styler’, array( $this,’ma_admin_styler_validate’)); add_settings_section(‘main_section’, ”, array( $this,’section_text_default’), ‘ma_admin_styler’); add_settings_field(‘error_font_color’, ‘Error Font Color’, array( $this,’ma_error_font_color’), ‘ma_admin_styler’, ‘main_section’); } The fourth parameter of add_settings_section() and add_settings_field() is $page and that needs to match the page ID set in add_options_page().
What you are doing is the safe way, and the way I’d recommend. To my knowledge, there is no Core function to bulk update only single values in the $wpdb->posts table, so to do that you’d need to write your own SQL… $ids = array(); // your IDs; I am assuming these to be validated … Read more
The problem I was encountering was a result of not realizing that the 3rd parameter for load_plugin_textdomain should be a relative path to the language directory from WP_PLUGIN_DIR. Since plugin_dir_path returns an absolute path, things broke. Changing the hooked function as follows solved the problem: add_action(‘plugins_loaded’, array(‘PluginName’, ‘loadTextDomain’)); class PluginName { public static function loadTextDomain() … Read more
You can check the $current_screen on the current_screen action, and redirect after checking some GET conditions: function wpd_current_screen( $current_screen ) { if ( ‘toplevel_page_your_menu_item_id’ == $current_screen->base ) { // check some condition and wp_redirect( admin_url() ); exit; } } add_action( ‘current_screen’, ‘wpd_current_screen’ );
The emailer::send is the function callback for a publish_post action hook. This action hook accepts only one parameter which is the post ID and it is passed by WordPress. When you define an action hook, you set what parameters are passed to the callback functions. For example: $arg_1 = “The aregument value”; do_action( ‘my_custom_action’, $arg_1 … Read more
This is very easy with post types generated by Pods. If you create a Custom Post Type with Pods, you can add this to Parent Menu ID: “edit.php?post_type=top_level_post_type”
You need to remember screen id of your page and check current screen id before adding new menu item: add_action( ‘admin_menu’, ‘my_plugin_menu’ ); function my_plugin_menu() { global $my_swell_plugin_page; $my_swell_plugin_page = add_menu_page( ‘My Swell Plugin’, ‘My Swell Plugin’, ‘edit_posts’, ‘blah’, ‘generate_main_page’ ); } function generate_main_page() { //We are definitely in our plugins page now – let’s … Read more
The proper way to include jquery in your plugin is /** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true ); } add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ );