Discuss your project

Category

Wordpress

24 articles

WordPress: Disable the Gutenberg editor in the widget administration

It surely did not escape your notice that WordPress updated its WYSIWYG content editor.And it works very well for standard content pages.A few months ago, the editor was implemented in the management of widgets. And then, bang…JS error when loading the page:index.js:1:3953Uncaught (in promise) TypeError: e is undefinedAnd it becomes impossible to edit already configured sidebars: "> While waiting for the Gutenberg issue to be resolved, you might ...

WordPress: Add a new widget area to a WordPress theme

If you're familiar with WordPress themes, you know that many themes come with a widgetized sidebar. This means that you can add, remove, and rearrange widgets on your WordPress website using the "Widgets" section of your WordPress dashboard.Having a widgetized sidebar is very useful, but you may also want to widgetize other parts of your WordPress theme. It's quite easy to do, and once your theme is modified, it will be simple for you or the WordPress admini...

Set the correct permissions for WordPress files

WordPress permissions should be set to 755 for directories and 644 for files.The entire set must have the same user/group as the server. chown www-data:www-data -R * find . -type d | xargs chmod -v 755 find . -type f | xargs chmod -v 644 Reproduce this customization today The principle of the hook remains useful, but the administration screens and WordPress APIs have evolved since the publication. Test the code in a staging environment with the exact version of the site's core, theme, and ...

WordPress: Reset the admin password

Useful when you receive project delivery, and the idiot who delivers it forgets to tell you that the password is admin1234. Instead of being stuck without being able to run your tests, you just need to apply the following SQL query:UPDATE wp_users SET user_pass = MD5( 'new_password' ) WHERE user_login = 'your-username'; Reproduce this customization today The principle of the hook remains useful, but the administration screens and WordPress APIs have evolved since the publication. Test the c...

WordPress: Delete all revisions in SQL

Revisions are good, but they consume database space. A little cleanup is necessary from time to time.DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision' Reproduce this customization today The principle of the hook remains useful, but the administration screens and WordPress APIs have evolved since the publication. Test the code in a staging environment with the exact version of t...

Apache: Overload htaccess authentication

To disable htaccess authentication, simply add a .htaccess to the root of the folder you wish to authorize with the following directive: Satisfy AnyOr you can place it directly in the vhost: Satisfy Any Compatibility context This procedure documents a PHP or Apache environment from its time. PHP 5.x and 7.x branches no longer receive standard support from the PHP project: do not deploy this configuration as is on a new server. First identify the versions actually installed and the loade...

WordPress: Rename the title of the excerpt editing area

It's true that when we talk about an excerpt, nobody understands what it refers to.To change the title of this editing area, just use the following snippet of code: add_filter( 'gettext', 'wpse22764_gettext', 10, 2 ); function wpse22764_gettext( $translation, $original ) { if ( 'Excerpt' == $original ) { return 'Sous-titre'; }else{ $pos = strpos($original, 'Excerpts are optional hand-crafted summaries of your'); if ($pos !== false) { return 'Sous-titre affiché dans les push.'; } } ret...

WordPress: Filter the MIME types of uploads

To ensure that just about anything isn't uploaded from the admin, you can configure the authorized MIME types as follows: add_filter('upload_mimes','custom_upload_mimes'); function custom_upload_mimes($mime_types=array()){ $mime_types = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'png' => 'image/png', 'mp4' => 'video/mp4', 'flv' => 'video/x-flv' ); return $mime_types; } Reproduce this customization today The principle of the hook remain...

WordPress: Add a filter by author in the admin posts list

To add an author filter on the list of articles page available in WordPress, simply add the following code to the functions.php file: Note: I have left the comment on the conditional instruction concerning the post types, it might come in handy 😊 function restrict_manage_authors() { /*if (isset($_GET['post_type']) && post_type_exists($_GET['post_type']) && in_array(strtolower($_GET['post_type']), array('your_custom_post_types', 'here'))) { */wp_dropdown_users(a...

WordPress: Remove comment metaboxes everywhere

To remove comment metaboxes from WordPress content editing pages, add the following code to your functions.php file: add_action('admin_menu','remove_comments_metabox'); function remove_comments_metabox() { remove_meta_box( 'postcomments','post','normal' ); } // Disable support for comments and trackbacks in post types function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remov...

WordPress: Change the default colors of the WordPress HTML editor

To change the default colors available in the WordPress WYSIWYG editor, simply add the following code to the functions.php file: // change buttons in WYSWIG post editor, edit color palette function change_mce_options( $init ) { $init['theme_advanced_text_colors'] = 'd21268,146c52,82b600,00949b,010080,001c4b'; $init['theme_advanced_more_colors'] = true; return $init; } add_filter('tiny_mce_before_init', 'change_mce_options'); Reproduce this customization today The principle of the hook rem...