How to remove dashboard access (wp-admin) for author but not disable the capabilities?

Use this code in your functions.php file or in a plugin- function wpse_253580_prevent_author_access(){ if( current_user_can( ‘author’ ) && is_admin() ) { // do something here. maybe redirect to homepage wp_safe_redirect( get_bloginfo( ‘url’ ) ); } } add_action( ‘admin_init’, ‘wpse_253580_prevent_author_access’ ); This will check if current user is an author and he is trying to access … Read more

Can content be recovered in this situation?

It is hard to guess what kind of a “crash” happened and why did it require the drastic roll back of the site. As far as themes go — they are normally just folders of code (if not going into complicated ones with page builders and such). If that code survived somewhere in your case … Read more

Minimum version for WordPress Backbone

It was introduced in 3.5 for the media library, but it’s been periodically updated since then. Honestly, it’s been around long enough that you’re almost certainly using something else that has a more recent requirement.

Editor’s role in WP

You are right indeed, users with the “editor” role do not have the ‘edit_theme_options’ capability, which is required to access the following: Appearance > Widgets Appearance > Menus Appearance > Customize if they are supported by the current theme Appearance > Background Appearance > Header (source) For a complete reference of roles and capabilities, and … Read more

Show data from one Custom Post Type in another Custom Post Type

Add a field to your form that allows selection of a machine. You can use get_posts to generate a select element: $args = [ ‘posts_per_page’ => -1, ‘post_type’ => ‘machine’ ]; $machines = get_posts( $args ); if( ! empty( $machines ) ){ echo ‘<select name=”_machine_id”>’; foreach( $machines as $machine ){ echo ‘<option value=”‘ . $machine->ID … Read more

Missing background image setting in admin of twenty nineteen

It’s not present because it’s not supposed to be present, it was removed. While originally added to the theme, it was deliberately removed due to accessibility concerns, see https://github.com/WordPress/twentynineteen/issues/708 which is the same question but on GitHub Keep in mind that the video you linked to is not the final version of the theme, but … Read more

Add custom classes for blocks in editor based on custom attributes

You can do this with the editor.BlockListBlock filter. More info here. This allows you to do something like the following: const withCustomAttributeClass = createHigherOrderComponent( ( BlockListBlock ) => { return ( props ) => { const { attributes } = props; const { yourCustomAttribute } = attributes; const class = yourCustomAttribute ? ‘my_custom_class’ : ”; … Read more