How can I create multiple different admin roles with their own capabilities

Yes it’s very easy. You’ll want to use the add_role() function to add your custom roles – https://codex.wordpress.org/Function_Reference/add_role Then you can use add_cap to add custom capabilities – https://codex.wordpress.org/Function_Reference/add_cap One important thing to mention is that both add_role and add_cap are saved to the database so they only need to run 1x so it’s good … Read more

Filter on the day of the week from timestamp

This answer may help someone who really wants to customize their filters. With PhpStorm and breakpoints I could walk through how the meta_query is constructed before posts are fetched. There are no hook points in the flow that let developers accomplish this; I’ve used a SQL-injection trick to achieve the filter. // Do advanced SQL … Read more

Add_Meta_box to custom page (formidable edit post)

Like this? <?php /* Plugin Name: Your plugin name Plugin URI: http://www.domain.com Description: Description Author: You obviously Version: 1.0 */ /** * Adds a meta box to the post editing screen */ include(‘meta_box/meta_box.php’); ?> meta_box.php <?php $post_id = $_GET[‘post’] ? $_GET[‘post’] : $_POST[‘post_ID’] ; $page_temp = get_page_template_slug( $post_id ); if ($page_temp == ‘template_name.php’) { function … Read more

How to customize WordPress dashboard for different users?

I would suggest this plugin: https://wordpress.org/plugins/adminimize/ What does this plugin do? The plugin changes the administration backend and gives you the power to assign rights on certain parts. Admins can activate/deactivate every part of the menu and even parts of the sub-menu. Meta fields can be administered separately for posts and pages. Certain parts of … Read more

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

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