Deprecated Functions Very important to see before making any theme/plugin

Deprecated Functions
When a new version of WordPress is being developed, certain functions may become deprecated. A deprecated function means the function is not removed from WordPress, but it should not be used in your plugins and themes going forward. Typically in such a case, a new function has been created to replace the deprecated function. A function may be deprecated in WordPress for many different reasons, but the most common is that the function needs a complete rewrite to better handle the feature it adds to WordPress. WordPress contains a fi le to store all functions that have been deprecated over the years. WordPress is known for having superior backwards compatibility. This means that when a new version of WordPress is released, a strong focus it put on backwards compatibility to verify new features and functions will not break existing sites running WordPress, even if the features in use are considered deprecated.
Let’s look at the inline documentation for the get_current_theme() deprecated function:
* Retrieve current theme name.
* @since 1.5.0
* @deprecated 3.4.0
* @deprecated Use (string) wp_get_theme()
* @see wp_get_theme()
* @return string
You’ll notice a few additional comment lines for deprecated functions. The fi rst is the
@deprecated line stating in what version of WordPress the function was deprecated, in this case v3.4. The second is @see which tells you what function should be used instead, in this case wp_get_theme(). The deprecated.php fi le is a very important fi le to check when a new version of WordPress is released. If a common function is deprecated, you should immediately stop using it and even consider updating your old code to use the replacement. Generally speaking deprecated functions are usually not removed from WordPress core, but there is no guarantee a deprecated function won’t be removed in a future release.


WordPress Common Core Files and Those Common Functions

The functions.php fi le contains the main WordPress API functions. These functions are used to easily interact with WordPress using a standardized method. Plugins, themes, and the WordPress core all use these functions:
➤ current_time — Retrieves the current time based on specifi ed type.
➤ force_ssl_login — Requires SSL (https) login to WordPress.
➤ wp_nonce_field — Displays a nonce hidden fi eld for forms. A nonce fi eld is used for
verifi cation purposes when submitting and processing data in WordPress. This is a critical step in securing your code.
➤ absint — Converts value to nonnegative integer.

The option.php fi le contains the main WordPress Options API functions. These functions are used for the following:
➤ add_option, update_option, get_option — Functions to create, update, and display a
saved option.
➤ set_transient, get_transient, delete_transient — Functions to create, retrieve, and
delete transients in WordPress. A transient is an option with an expiration time. When the expiration time is hit, the transient is automatically deleted in WordPress.
➤ add_site_option, update_site_option, get_site_option — Functions to create,
update, and display site options. If Multisite is enabled, function returns the network
option; if not, the standard site option is returned.

The formatting.php fi le contains the WordPress API formatting functions. These functions format the output in many different ways:
➤ esc_attr — Used to escape a string for HTML attributes.
➤ esc_html — Used to escape a string for HTML.
➤ esc_url — Used to check and clean a URL.
➤ sanitize_text_field — Sanitizes a string from user input or from the database.
➤ is_email — Verifi es that an e-mail is valid.
➤ capital_P_dangit — Famous fi lter that forces the P in WordPress to be capitalized when displaying in content.

The pluggable functions fi le lets you override certain core functions of WordPress. WordPress loads these functions if they are still undefi ned after all plugins have been loaded. Some of the more commonly used functions include:
➤ wp_mail — Sends e-mail from WordPress.
➤ get_userdata — Returns all user data from the specifi ed user ID.
➤ get_currentuserinfo — Returns user data for the currently logged-in user.
➤ wp_set_password — Updates a user’s password with a new encrypted one.
➤ wp_rand — Generates a random number.
➤ wp_logout — Logs out a user, destroying the user session.
➤ wp_redirect — Redirects to another page.
➤ get_avatar — Returns the user’s avatar.

The plugin.php fi le contains the WordPress Plugin API functions, including:
➤ add_filter — Hooks that the WordPress core launches to fi lter content before displaying on the screen or saving in the database.
➤ add_action — Hooks that the WordPress core launches at specifi c points of execution.
➤ register_activation_hook — Hook called when a plugin is activated.
➤ register_deactivation_hook — Hook called when a plugin is deactivated.
➤ plugin_dir_url — Returns the fi lesystem directory path for the plugin.
➤ plugin_dir_path — Returns the URL for the plugin.

The user.php fi le contains the WordPress User API functions, including:
➤ get_users — Returns a list of users matching criteria provided.
➤ add_user_meta, get_user_meta, delete_user_meta — Used to create, retrieve, and delete user metadata.
➤ username_exists — Checks if a username exists.
➤ email_exists — Checks if an e-mail address exists.
➤ wp_insert_user and wp_update_user — Create and update a user account.

The post.php fi le contains the functions used in the post process of WordPress, including:
➤ wp_insert_post — Creates a new post.
➤ get_posts — Retrieves a list of the latest posts’ matching criteria.
➤ add_post_meta — Creates metadata (custom fi eld data) on a post.
➤ get_post_meta — Retrieves metadata (custom fi eld data) on a post.
➤ get_post_custom — Returns a multidimensional array with all metadata (custom fi eld)
entries for a post.
➤ set_post_thumbnail — Sets a featured image on a post.
➤ register_post_type — Registers a custom post type in WordPress.
The plugin registration functions add_filter() and add_hook() are key to extending how
WordPress processes content, and these functions let you extend the basic content data structures

The taxonomy.php fi le contains the functions used by the WordPress Taxonomy API. Taxonomies are used to manage the hierarchical relationships of metadata such as categories and tags Functions in this file include:
➤ register_taxonomy — Registers a custom taxonomy in WordPress.
➤ get_taxonomies — Returns a list of registered taxonomies.
➤ wp_insert_term, wp_update_term — Insert or update a taxonomy term based on arguments provided.



Easily Change WordPress Site URL No Need to Touch Database

This is a useful technique if you are building a WordPress website under
a temporary development URL, such as You can simply
remove these two options when you go live and WordPress will load using the
production URL instead.

You can set additional advanced options in your wp-config fi le. These options are not in the
wp-config fi le by default so you will need to manually add them to the fi le.
To set your WordPress address and blog address, use the following two options:

define( ‘WP_SITEURL’, ‘’ );
define( ‘WP_HOME’, ‘’ );

The WP_SITEURL option allows you to temporarily change the WordPress site URL. This does not alter the database option value for siteurl, but instead temporarily changes the value. If this option is removed, WordPress reverts back to using the siteurl database setting.

The WP_HOME option works the exact same way, letting you temporarily change the home value for WordPress. Both values should include the full URL including http://.



What is WordPress Secret Keys and Salt

First we need to know why we need this? Simple, for example your wordpress site hacked and hacker logged in by different way and keep posting then if you change your all user pass then then change all Secret keys then before doing anything wordpress will ask them to login again and you already changed the pass so they cant login anymore.



  • LOGGED_IN_KEY – It will be used to generate a cookie for a logged in user and this cookie can’t be used to make changes on the blog.
  • SECURE_AUTH_KEY – It is used to sign an auth cookie for SSL admin and these cookie can be used to make changes on blog. (With the new version there will be two type of auth cookie one for SSL and other for non-SSL)
  • AUTH_KEY – It is used to sign the auth cookie for the non-SSL. These can also be used to make changes on blog.
  • NONCE_KEY – It is used to sign the nonce key which protects the nonces from being generated, protecting you from certain forms of attacks where a hacker attempts to guess the nonce.

Joomla 3.x Component Basic Structure


Basic Idea:

When you call a page link, like index.php?option=com_<name>, the Joomla! Platform tries to find and load the file components/com_<name>/<name>.php from whichever folder you have installed Joomla! into. So, if your component is ‘com_read’ you should have a ‘com_read’ folder and a file named ‘read.php’ inside of it.

I will call this file the ‘base file’. It is in this file that you make the decision whether to use an old flat model (returning the HTML code for the requested page) or to use a Model-View-Controller (MVC) pattern.

This MVC model, walks over two legs: a file and a class. The Joomla! Platform will usually look for a given file and, if found, tries to register a specific class within this file. If either one is missing the call will fail.

Continue reading


Copyright © 2015 CMSFanatics

Theme by Anders NorenUp ↑