Tag Info

Hot answers tagged

3

Add the following code to your functions.php: function allow_contributor_uploads() { $contributor = get_role('contributor'); $contributor->add_cap('upload_files'); } if ( current_user_can('contributor') && !current_user_can('upload_files') ) { add_action('admin_init', 'allow_contributor_uploads'); } This will add the upload_files ...


2

You can check existing user with "username_exists" WordPress function and insert user using "wp_insert_user" function as below for Network site also: if(username_exists( 'username' )) { echo "Username already exists"; } else { echo "Username does not exists"; $userdata = array( 'user_login' => 'username', 'user_url' => ...


1

With help from @Howdy_McGee: delete plugin from server clear browser cache delete site cookies close & re-open browser


1

You are using PHP tag inside echo statement. Try this: echo '<a href="'.wp_logout_url().'" title="Logout">Logout</a>'; If you want to redirect to any specific url then you can pass it as argument of wp_logout_url. Check official documentation of wp_logout_url. Note : It is recommended to return value from the shortcode function rather than ...


1

Use wp_localize_script() to pass any kind of data to your loaded scripts, in this case we need plugins_url(): wp_enqueue_script('my-script', get_stylesheet_directory_uri() . '/js/my-script.js'); wp_localize_script('my-script', 'myScript', array( 'pluginsUrl' => plugins_url(), )); Now you will have access to myScript.pluginsUrl in your script file: ...


1

Read: SELECT_a_Column $sql = "SELECT 'liters' FROM " . $wpdb->prefix . "tfp"; $liters = $wpdb->get_col( $sql ); if( $liters ) { foreach( $liters as $liter ) { echo '<option value="' . $liter . '">' . $liter . '</option>'; } }



Only top voted, non community-wiki answers of a minimum length are eligible