How does admin-ajax.php work?

admin-ajax.php is part of the WordPress AJAX API, and yes, it does handle requests from both backend and front. Try not to worry about the fact that it is in wp-admin. I think that is a strange place for it too, but it is not a security problem in itself. How this relates to “enumerate … Read more

Adding a custom admin page

You need just two steps: Hook into the action admin_menu, register the page with a callback function to print the content. In your callback function load the file from plugin_dir_path( __FILE__ ) . “included.html”. Demo code: add_action( ‘admin_menu’, ‘wpse_91693_register’ ); function wpse_91693_register() { add_menu_page( ‘Include Text’, // page title ‘Include Text’, // menu title ‘manage_options’, … Read more

Disable dragging of meta boxes?

I had the same problem, and Google lead me here. Unfortunately none of these answers helped, but I ultimately figured out the answer, and it’s quite easy! First, enqueue a JavaScript file (I won’t rehash this process; there are many tutorials that can describe this process better than I). I hooked into admin_enqueue_scripts, and it … Read more

Admin Page Redirect

/** * Redirect admin pages. * * Redirect specific admin page to another specific admin page. * * @return void * @author Michael Ecklund * */ function disallowed_admin_pages() { global $pagenow; # Check current admin page. if ( $pagenow == ‘edit.php’ && isset( $_GET[‘post_type’] ) && $_GET[‘post_type’] == ‘page’ ) { wp_redirect( admin_url( ‘/post-new.php?post_type=page’ ) … Read more

Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?

Positions for Core Menu Items 2 Dashboard 4 Separator 5 Posts 10 Media 15 Links 20 Pages 25 Comments 59 Separator 60 Appearance 65 Plugins 70 Users 75 Tools 80 Settings 99 Separator Parameter description for “menu position” $position (integer) (optional) The position in the menu order this menu should appear. By default, if this … Read more

Modal window from within WordPress admin

Give the anchor a class of thickbox and make sure that the thickbox script is enqueued on your admin page using add_thickbox add_thickbox(); and <a href=”https://wordpress.stackexchange.com/questions/48514/your url” class=”thickbox”>click here</a> You can see what add_thickbox does here: http://hitchhackerguide.com/2011/02/11/add_thickbox/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)