Get Link of Page Selected through a Select Field in Custom Admin Page

First, you register your setting like this: function my_awesome_register_fields_for_additional_settings(){ register_setting(‘reading’, ‘my_awesome_pagelink_for_frontend_button’); add_settings_field(‘my_awesome_pagelink_for_frontend_button’, ‘<label for=”my_awesome_pagelink_for_frontend_button”>The Frontend Button shall link to this page:</label>’ , ‘my_awesome_pagelink_for_frontend_button_html’, ‘reading’); } add_filter(‘admin_init’, ‘my_awesome_register_fields_for_additional_settings’); After that, you define the callback for your settings field: function my_awesome_pagelink_for_frontend_button_html(){ $option = (int)get_option(‘my_awesome_pagelink_for_frontend_button’,0); wp_dropdown_pages(array( ‘selected’ => $option, ‘name’ => ‘my_awesome_pagelink_for_frontend_button’, ‘show_option_none’ => ‘Please Choose’, ‘option_none_value’ => … Read more

Show only content in page after action click in WordPress admin

to create a page with your own content, you can do like that : add_action(“admin_menu”, function () { $post_type = get_post_type_object(“property”); add_submenu_page( ” ” , “Page title” , “” , $post_type->cap->edit_posts , “property__validationForm” , function () { do_action(“property/validationForm”); } ); }); add_action(“property/validationForm”, function () { ?> <pre><?php var_dump($_GET);?></pre> form <?php }); to create a URL … Read more

Blank WordPress admin/dashboard (7 updates pending)

Ok, first thing is to backup your entire site if possible. At least backup the database (which you should be able to do from the tools provided by your hosting company.) Next thing is to start deactivating plugins. Try one at a time… and see if the full admin/dashboard returns. As I guess you can’t … Read more

Hide top admin panel for non admin and non editors

This is what i am using; add_action(‘init’, ‘blockusers_init’); function blockusers_init() { if (is_admin() && !current_user_can(‘administrator’) && !(defined(‘DOING_AJAX’) && DOING_AJAX)) { wp_redirect(home_url()); exit; } } It’s possible the best one. EDIT : You need a custom login page for reach wp-admin. This code redirect to homepage if you enter directly to wp-admin.

Where to store publicly-accessible files

I think that would depend how you’ve made your site private? I’ve used this plugin to set sites to private https://wordpress.org/plugins/jonradio-private-site/ It also has settings to exclude any URLs from being set to private. There are a bunch of other plugins that do similar thins.

Admin Access for specific page(s)

I know this question is kind of off-topic but I need to come in and say firstly don’t add anybody… anybody…. ANYBODY!! as admin on the site… At that level they can do everything you can do, or probably a lot more if they actually know what they’re doing :-p It’s a good way of … Read more

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