Category Archives: PHP

How to Disable File Editing from WordPress Admin Dashboad

As you all know WordPress allow us to edit files from the WordPress Admin Dashboad. This is a good feature. But it can be harmful for your website. If any hackers gain access to your WordPress admin panel, they can inject subtle, malicious code to your theme and plugin.

To disable the ability to edit plugins and the theme files, Just paste the following code in your wp-config.php file.

   define('DISALLOW_FILE_EDIT', true);

How to Disable Plugin Updates in WordPress

For example if you want to hide update notification for akismet plugin, you need to add the following function in your theme functions.php file.

function filter_plugin_updates( $value ) {
    unset( $value->response['akismet/akismet.php'] );
    return $value;
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );

How to Limit the Number of Archive Months Displayed in WordPress

If you want to display the number of archive months in WordPress then you just need to add the below function in functions.php file of your current active theme.

After adding the below function in functions.php use the shortcode in WordPress text editor or text widget. This will display archives list with limited months which you will set in the below function.

// Function to get archives list with limited months
function wpb_limit_archives() { 
$my_archives = wp_get_archives(array(
return $my_archives; 
// Create a shortcode
add_shortcode('w3m_custom_archives', 'w3m_limit_archives'); 
// Enable shortcode execution in text widget
add_filter('widget_text', 'do_shortcode');