Tag Info

New answers tagged

0

It's simply the wrong endpoint. The admin_post_* hook and its admin_post_nopriv_* counterpart is not fired for any admin page with the appropriate action request variable set, it only triggers for requests hitting wp-admin/admin-post.php. Try https://test.local/wp-admin/admin-post.php?action=test instead. I should add that using admin-post.php for ...


0

The simplest solution I have for this, is in my themes function, or in a custom plugin file (if you have plugins you are working with) add this code: <?php add_action( 'admin_head', 'kaz_stop_sidescroll' ); funciton kaz_stop_sidescroll(){ ?> <style type="text/css"> #adminmenuwrap{ position: relative!important;} </style> ...


0

In case you use a "child theme", i would search also in the parent themes function.php @see https://codex.wordpress.org/Child_Themes


0

This is what worked for me in the end. I used this to add a metabox: <?php add_action( 'add_meta_boxes', 'so_custom_meta_box' ); function so_custom_meta_box($post){ add_meta_box('so_meta_box', 'Additional', 'custom_element_grid_class_meta_box', 'event', 'normal' , 'high'); } add_action('save_post', 'so_save_metabox'); function so_save_metabox(){ ...


1

Use wp-admin/admin.php with an action parameter: <a href="<?php echo esc_url( admin_url( "admin.php?action=wpse_184153_create_page&user_id=$user_id" ) ) ?>">Create Page</a> And then hook onto the event: function wpse_184153_create_page() { $redirect = admin_url( 'users.php' ); if ( ! empty( $_GET['user_id'] ) && ...


0

If you do want to make a button from scratch try using this code: <script type="text/javascript" src="<your installation path>/tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea", toolbar: "mybutton", setup: function(editor) { editor.addButton('mybutton', { ...


0

The accepted answer mentions User Role but actually uses the function for User Capability Here's the solution for User Roles function wpse66094_no_admin_access() { $redirect = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : home_url( '/' ); global $current_user; $user_roles = $current_user->roles; $user_role = ...


0

That is pretty easy to do with WP's login_redirect filter. A small snippet like this added to your functions.php file would do it: /** * Return the url you want to redirect to after login. * This example redirects the user to the main page. */ add_filter( 'login_redirect', 'my_login_redirect' ); function my_login_redirect( $redirect_to ) { return ...


0

The second parameter of selected() has to agree with the value attribute of the current <option>. So assuming you have stuffed $selected with the value given by the relevant get_post_meta(), the following should work for you: <label for="myplugin_meta_box_select">Status:</label> <select name="myplugin_meta_box_select" ...


0

add_action( 'admin_footer', 'my_action_javascript' ); // Write our JS below here function my_action_javascript() global $wpdb; $pageposts = $wpdb->get_var("SELECT max(menu_order) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type ='post_trainers'"); ?> <script type="text/javascript" > ...


1

Try add_action( 'admin_menu', 'wpse182102_register_my_custom_menu_page' ); function wpse182102_register_my_custom_menu_page() { add_pages_page(null, 'Menu Item Name', 'edit_posts',/* or whatever capability required for this object */ '/post.php?post='.get_page_by_title('Etusivu')->ID.'&action=edit', null, ''); } And change Etusivu to be the ...


1

Found it! I was missing one custom capability. To the code above, I added this line: $rol->add_cap( 'edit_' . $cap[0] ); It gives the capability edit_ctpsinglename. (edit_pb_publicacion). And now it works just fine. Hope someone find's this useful.


0

Is your problem occurring in a multisite setup? If so, here is a solution: http://thereforei.am/2011/03/15/how-to-allow-administrators-to-edit-users-in-a-wordpress-network/ By default in a multisite setup, only Super Administrators can edit users.


0

Doesn't get_edit_user_link do just that?


0

I just should make Method 1 $object->set('meta_key', 'post_views_count'); Method 2 $query->set( 'meta_key', 'post_views_count' ); Method 3 $vars['meta_key'] = 'post_views_count';



Top 50 recent answers are included