How do I add some javascript validation to the admin interface form’s onsubmit?

Every post / page / post type is wrapped around a universal form with the ID of #post. So if you want to validate a page before submitting it you just need to say something like: jQuery(document).ready(function($){ $(‘#post’).submit(function(){ // Validate Stuff return false; }); }); Then you’ll want to actually enqueue your javascript – View … Read more

Can’t use admin_enqueue_scripts or wp_enqueue_script

Right now your error is that you forgot to enqueue them, function theme_enqueue_scripts(){ wp_register_script(‘modernizr’, get_stylesheet_directory_uri() . ‘/js/modernizr.js’); wp_register_script(‘require’, get_stylesheet_directory_uri() . ‘/js/vendor/requirejs/require.js’, array(), false, true); wp_register_script(‘global’, get_stylesheet_directory_uri() . ‘/js/global.js’, array(‘require’), false, true); wp_register_style(‘globalstyle’, get_stylesheet_directory_uri() . ‘/css/global.css’); wp_enqueue_script( array(‘modernizr’,’require’,’global’) ); wp_enqueue_style (‘globalstyle’); } add_action(‘wp_enqueue_scripts’, ‘theme_enqueue_scripts’); function navigation_script() { wp_register_script(‘admin-nav’, get_stylesheet_directory_uri() . ‘/js/admin-nav.js’,array(), null, true); wp_enqueue_script(‘admin-nav’); } add_action( … Read more

How to change all “Post” texts in dahboard into “Article”?

You can update the override the post labels: function wpse163462_rename_menu_post_to_article() { global $menu; global $submenu; $menu[5][0] = ‘Articles’; $submenu[‘edit.php’][5][0] = ‘Articles’; $submenu[‘edit.php’][10][0] = ‘Add Articles’; echo ”; } function wpse163462_rename_post_to_article() { global $wp_post_types; $labels = &$wp_post_types[‘post’]->labels; $labels->name=”Articles”; $labels->singular_name=”Article”; $labels->add_new = ‘Add Article’; $labels->add_new_item = ‘Add Article’; $labels->edit_item = ‘Edit Article’; $labels->new_item = ‘Article’; $labels->view_item = … Read more

Bind custom role to admin page

So for your information (based on add_menu_page) i am suggesting you to check the codex of add_menu_page in wordpress http://codex.wordpress.org/Function_Reference/add_menu_page if you look into the parameter of add_menu_page third one is for $capability just change it below code manage_options to manage_wpse_173073 (or any name you want) and just assign that capability to your custom role. … Read more

WordPress Brute Force Prevention

Rather than blacklist logins, why not whitelist your own IP (example 12.345.67.891 below; or a range) for wp-login.php and in wp-admin for logins and administration? (No plugin needed). A whitelist will block everyone else except you from login. See http://httpd.apache.org/docs/2.4/howto/access.html in the .htaccess in the wp-admin folder: Options All -Indexes order deny,allow deny from all … Read more