Tag Info

New answers tagged

1

I would try something like below. Since current_user_can is called right before displaying the link, we have to hook where capabilities are checked. function wpse200630_has_cap_check( $allcaps, $caps, $args, $user ){ if( function_exists( 'get_current_screen' ) ){ $screen = get_current_screen(); if( $screen->base == 'edit' && ...


0

There's only one plugin that I know it does that right now. It's called Press Permit, and you will need the Pro (paid) version if you want the functionality of editing specific pages. I am still looking for another alternative as the UI of this plugin is not the best.


0

You can write a small custom function, that loop about the network and add in each site of the network the new role. See the source below als example to add_role. If you like update or change a existing role, then switch from add_role to add_cap. function fb_change_role_network_wide( $role ) { global $wpdb; $args = $args = array( ...


0

I'd try this with two steps. First, install the Multisite User Plugin or grab the useful bits from its code. Short version: It hooks into user_register and loops through each blog in a multisite, adding the user to each one with a preset role. Handy. Second, use wp-cli to import a CSV of users: wp user import-csv /path/to/users.csv By default, this will ...


0

As to No. 1 - remove_post_type_support( $post_type, 'comments' ); needs to be hooked to init. Codex: https://codex.wordpress.org/Function_Reference/remove_post_type_support There seems to be comments_open filter as well: function filter_media_comment_status( $open, $post_id ) { $post = get_post( $post_id ); if( $post->post_type == 'attachment' ...


0

I made it different for that project. Using ACF Pro (anyway) + a mod of "Code Area". Return that Code Area CSS via add_action('admin_head', 'function_name'); in my admin-area. So I am able to put the IDs in my CSS field => VoilĂ . A different way, but works exact as I wanted/ needed.


0

There are several options, you might want to combine them in some way. The list is in an increasing order of complexity and time that you will need to spend to implement it. Backup plugins. They usually do a full backup of the site and let you restore it into different domain. You can automate task like use registration and post deletion by writting ...


1

If you dont want 'TopLevel' menu to represent a custom page you can use: add_menu_page( 'TopLevel', 'TopLevel', 'MENU_CAP_LVL', 'MENU_SLUG', 'MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu', 'SubMenu', 'MENU_CAP_LVL', 'SUB_MENU_SLUG', 'SUB_MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu-A', 'SubMenu-A', 'MENU_CAP_LVL', 'SUB_MENU_A_SLUG', ...


-1

You can easily handle via css. Like .class_name{ display:none; } Hopefully it will work for you.


0

Ok, I figured it out: If it's a submenu page, the $hook looks like this: appearance_page_page-name instead of going by URL. So the complete code would be this: function my_function($hook) { if ( 'appearance_page_page-name' != $hook ) { return; } wp_enqueue_style( 'custom-style', get_template_directory_uri() . 'custom-page/style.css' ); } ...


0

if you have declared the page with add_theme_page(..., you can add the stylesheet in the hook load-appearance_page_page-name or admin_print_styles-appearance_page_page-name. for information, these are some hook which are fired when you load the page (it's not the whole list but the most interesting for your question) plugins_loaded init admin_init ...


0

"Developer" implies that he will have access to the code - in which case he has carte blanche to do whatever he likes. If you actually mean he just has access to the site admin - and I assume this is multisite as you mentioned being a Super Admin - then a site Admin cannot remove a Super Admin / Network Admin. Capabilities are very atomic - meaning if you ...


1

I would agree that current_user_can('Administrator') should return true for the user. However, current_user_can is primarily intended to check for capabilities, which is generally a more robust check to be making. I'd suggest something like this (untested): if ( current_user_can( 'activate_plugins' ) && ! current_user_can( 'update_core' ) ) { //... ...


-1

Look WP GG Search! It is a powerful plugin to search everything in the backend. It supports also Custom Post types. If you want to expand it there are a few of free plugins. It provides a easy API documentation, look at the page... My feedback to this plugin: it is very easy to use and you safe a lot of time while working with wordpress! Edit (sorry for ...


0

I use MAINWP https://mainwp.com/. I set up a domain to host a singular wordpress site with the dashboard for MainWP then installed the child plugin to all the sites I want to manage. Import the sites to the main site and manage them all from there. Has been excellent and its FREE..


0

This could be the answer: http://codepen.io/flesler/pen/AEIFc Just adding the following CSS will make it work like a placeholder: [contenteditable=true]:empty:before { content: attr(placeholder); display: block; /* For Firefox */ } We just need to find a way to add a data-attribute to the contenteditable element in the tinyMCE and also add the ...


0

To avoid message being sent to spam, you can use a transactional email service (two with free plans are mailgun and mandrillapp). You can use the smtp settings they provide with the postman-smtp plugin (https://wordpress.org/plugins/postman-smtp/). Be sure to configure the DNS settings for better deliverability. I would prefer not to use no-replay emails. ...


0

I would recommend to use the domain of the website as the email address. It's look more professional and formal. You can use no-reply email for sent messages related to the shop as sales@example.com and for the main email address I would recommend to use contact@example.com. You always can change the email address that you entered and test it but if the ...


0

A 0 status from admin-ajax.php indicates that no "action" is being parsed. When you enqueue the script you are assigning a handle, this handle needs to be used when you use wp_localize_script and additionally you need to assign the url. https://codex.wordpress.org/Function_Reference/wp_localize_script wp_register_script( 'some_handle', ...


0

add_action( 'edit_form_after_title', 'my_edit_form_after_title'); function my_edit_form_after_title($post) { $post_types = array( 'page' ); // post type / s $templates = array( 'template-custom.php' ); // not edit :D if( !in_array( $post->post_type, $post_types) ) return; if( !in_array( get_page_template_slug(), $templates) ) return; ...


2

Go to your domain and type /wp-admin and log on with your username and password. http//www.yourdomain.com/wp-admin Then go to appearance, themes and then activate your theme. If it's not already installed you can either drag your theme to the wp-content/themes folder or install it from within the themes area.


0

Here is a small snippet that will do the job. Found it here. /* * Hide Specified Categories (by ID) from administrators */ add_action( 'admin_init', 'wpse_55202_do_terms_exclusion' ); function wpse_55202_do_terms_exclusion() { //Where is the string 'author' you need to replace it with your users' role if( current_user_can('author') ) ...


0

Remove the true parameter in the get_permalink function $url = get_permalink( $post_id );


1

It's easier then you thought! Just add this code to the functions.php file in your theme. function prefix_set_default_editor() { return 'text'; } add_filter( 'wp_default_editor', 'prefix_set_default_editor' );


0

You can use Advanced Access Manager for access control on pages but you need to set which pages give these control. You can also control the comment, read and more. Please check this may help you.


1

I got it to work as follows -- in mu-plugins directory, my superAdmin.php script looks like this: <?php function check_for_superAdmin($user_login, $user) { $current_user = get_userdatabylogin($user_login); if ( is_super_admin( $current_user->ID ) ) { // do these things } else { // do other things } } add_action( 'wp_login', ...



Top 50 recent answers are included