Mandar Apte

UI/UX Designer from Mumbai, Maharashtra, India.

Category: Code Examples

  • How to Automatically Empty WordPress Trash.

    This wp-config.php function controls the days before WordPress permanently deletes posts, pages, attachments & comments from the trash bin.

    This function will automate the process of deleting WordPress Trash & you will not have to press the ‘Empty Trash’ button again for your installation.

    Default WordPress Trash Settings:
    The default is 30 days.

    define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days default
    (more…)
  • What is WordPress Salt? A WordPress Security or Secret Key Generator (WordPress Tip for Optimum Security)

    Introduction to WordPress Security Keys
    WordPress introduced security keys in the WordPress 2.6 Release to better encrypt information stored in the user’s cookies.

    Security Keys will look like these examples, but don’t use the duplicate keys given below:

    define( 'AUTH_KEY',         't`DK%X:>xy|e-Z(BXb/f(Ur`8#~UzUQG-^_Cs_GHs5U-&Wb?pgn^p8(2@}IcnCa|' );
    define( 'SECURE_AUTH_KEY',  'D&ovlU#|CvJ##uNq}bel+^MFtT&.b9{UvR]g%ixsXhGlRJ7q!h}XWdEC[BOKXssj' );
    define( 'LOGGED_IN_KEY',    'MGKi8Br(&{H*~&0s;{k0<S(O:+f#WM+q|npJ-+P;RDKT:~jrmgj#/-,[hOBk!ry^' );
    define( 'NONCE_KEY',        'FIsAsXJKL5ZlQo)iD-pt??eUbdc{_Cn<4!d~yqz))&B D?AwK%)+)F2aNwI|siOe' );
    define( 'AUTH_SALT',        '7T-!^i!0,w)L#JK@pc2{8XE[DenYI^BVf{L:jvF,hf}zBf883td6D;Vcy8,S)-&G' );
    define( 'SECURE_AUTH_SALT', 'I6`V|mDZq21-J|ihb u^q0F }F_NUcy`l,=obGtq*p#Ybe4a31R,r=|n#=]@]c #' );
    define( 'LOGGED_IN_SALT',   'w<$4c$Hmd%/*]`Oom>(hdXW|0M=X={we6;Mpvtg+V.o<$|#_}qG(GaVDEsn,~*4i' );
    define( 'NONCE_SALT',       'a|#h{c5|P &xWs4IZ20c2&%4!c(/uG}W:mAvy<I44`jAbup]t=]V<`}.py(wTP%%' );

    Benefits of WordPress ‘Salt’

    (more…)
  • Reduce MySQL Database size by managing WordPress Post Revisions count (WordPress Tip for Optimum Performance)

    Description:
    The WordPress revisions system records each saved draft or published update. You can see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what changed in each revision—what was added, what remained unchanged, and what was removed. Lines added or removed are highlighted, and individual character changes are highlighted. Click the ‘Restore This Revision’ button to restore a revision.

    Introduction to feature called revisions:
    As stated above, ‘Revisions’ are posts stored drafts for future proofreading of blog posts. It creates multiple copies of the blog posts you are working on in your MySQL Database in plain English. So it naturally affects & increases the size of your WordPress’s MySQL Database size in megabytes.

    Suggestion:
    So I would suggest using the following code to successfully control the WordPress Post Revision Count to ultimate ‘3’ to stop it from growing above & creating clutter in your WordPress Database.

    Specification:
    Put the following code in your WordPress Installation’s wp-config.php file to limit the number of post-revision WordPress stores in the database. Old revisions are automatically deleted.

    (more…)
  • How to selectively or enable & disable ‘WordPress Automatic Background Updates’ while modifying code in the WordPress root wp-config.php file & Your theme’s functions.php file

    Introduction to WordPress’s New Functionality Automatic Background Updates:
    WordPress 3.7 introduced automatic background updates to promote greater security and streamline the update process. By default, only minor releases are enabled for maintenance and security purposes, as well as translation file updates. The default behaviour in WordPress 3.7 is the automatic core update for minor versions, i.e., from 3.7.0 to 3.7.1. WordPress’s Graphical User Interface (GUI) does not offer configuration options. To change the behaviour, modify the wp-config.php file in your WordPress root installation or add filters to your theme’s functions.php file.

    In WordPress, there are four types of automatic background updates:

    1. Core updates
    2. Plugin updates
    3. Theme updates
    4. Translation file updates

    Core Updates
    Core updates are subdivided into three types:

    1. Core development updates, known as the “bleeding edge.”
    2. Minor core updates, such as maintenance and security releases, e.g. 3.7.1
    3. Major core release updates, e.g. 3.7

    But If you want to turn them on or off selectively, here is how you will do it,

    Turn them on or off via wp-config.php

    Enable Automatic Updates for core – development, major, and minor versions

    (more…)
  • Maintenance Tips for Your Macintosh to Tune up Mac’s performance for maximum productivity

    Here are a few OSX Maintenance Tips that can boost your Macintosh’s performance over the years.

    Mavericks-OSX-icon

     
    Ideally, you should perform these tasks once a month or weekly, which will optimize and tune up your Mac so that it runs at its optimum level.

    Here are the following things that you have to perform,

    (more…)
  • How do you put comments in .php, .html, and .css files to declare? Remind third-party developers and designers of the code’s explanation.

    Different ways of putting comments per file type on the World Wide Web exist.

    Comments help the code developer explain quickly to third-party developers, designers, users, or even himself why he used that line of code and what function it performs in that web application.

    So it is convenient to know how to put comments in your files in PHP, CSS & HTML.

    Here is an example of how you will put comments in ‘HTML’ & ‘PHP’ pages (outside of the PHP code) & it will look like this:

    <!-- comment here about what is going on -->

    Comments inside of PHP code look like this:

    <?php the_excerpt(); // Show excerpt and not full post content ?>
    (more…)
  • WordPress Installation Security & Performance Boosting with easy .htaccess hacks.

    I am writing it down to help you secure your website & boost your WordPress website performance with this simple .htaccess hack.

    Implement or copy-paste this code in .htaccess in your root of WordPress installation to secure wp-include only files.

    # Block the include-only files.
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    # RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    (more…)
  • After creating WordPress subdomain multisite blog Adsense ads on subdomain blog doesn’t get registered & Data in Analytics & Adsense doesn’t match…

    I have been using WordPress CMS for the last year or two & integrated Adsense ads & analytics without any errors or problems.

    But just after creating a WordPress Multi-Blog System with Subdomain, I started facing problems because my pages were not getting registered or Adsense ads clicks were not getting registered, so I was losing money and analytics data count.

    But after a few months, I found the solution; I got my analytics code rectified & all Adsense ads clicks started getting registered & my analytics code started working again,

    A few suggestions before starting: don’t follow idiot blogs that don’t follow Google’s Rules.

    So here are the steps to integrate the WordPress Multi Blog System with Google Analytics & Adsense.

    Step 01
    Check analytics code
    Go to: All Accounts > Account List > Admin > (Your Preferred Account) > Properties > (Your Preferred Website) > Tracking Code > Section Called ‘Website Tracking’ > Go to Advance Tab > Choose ‘One Domain with Multiple Subdomains’

    Now copy that underneath code & paste it to your WordPress theme…

    (more…)
  • Final Solution If MAMP Apache Server won’t start or doesn’t start at all

    Before switching to Mac OSX Lion 10.7 & MAMP 2.0.2, I was using Mac OSX Snow Leopard 10.6.8 with MAMP 1.9.5

    After Upgrading to Mac OSX Lion 10.7 and MAMP 2.0.1 or 2.0.2, suddenly everything went wrong. The Apache Server doesn’t start.

    For almost the last month, I have been unable to update my website theme offline…

    But when I check the folder called ‘log’ inside MAMP’s folder under applications (/Applications/MAMP/logs)

    I opened the ‘apache_error.log’ Apache Log file, and there was a reason on my iMac why MAMP’s Apache server was not running.

    Error: [Date] [alert] (EAI 8)nodename nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of “000-000-000-000.static.broadbandcompanyname”

    So, the Error was related to ‘IPv4’

    (more…)

Sponsors


Search