AUTHOR: // CATEGORY: Development, Wordpress

    No Comments

    How to Force Download of Mp3 Files Instead of Streaming

    For example, you’re running a mp3 site on wordpress and hosting audio files on your own server. By default when an user click on a mp3 file link, it automatically play the audio instead of downloading. This could make your site user annoying as he have to right click on the file and choose Save As to download it. In this article, we will show you how to Force Download of Mp3 files instead of Streaming without plugins.

    You can disable this streaming feature in WordPress by add some lines of code in your WordPress site’s .htaccess file located in the root directory of your wordpress install. To edit the .htaccess file you need to login into your hosting and navigate to File Manager.

    Once navigated to your file manager, you will find a .htaccess file in your site’s root directory. .htaccess is a hidden file by default, so if you can’t find it on your server, you need to make sure that you have enabled your file manager to show hidden files.

    You can edit your .htaccess file by downloading it to your pc or code edit feature on your server. After open it at the end of your WordPress generated code in the .htaccess file simply add these lines at the bottom as shown in the image below:

    force download mp3 instead of play wordpress

    You can change or add any other file type based on your need (example: pdf, mp4, doc)

    Now save your .htaccess file. That’s all you need to do. Streaming feature is now disabled on your WordPress site and people can download mp3 files hosting on your blog by just click on it.

    We hope this article will help you to learn How to force download after a click on the mp3 file link. For questions and feedback you can leave a comment below or join us on our forum.



    AUTHOR: // CATEGORY: Development, Wordpress

    No Comments

    Duplicating posts is a very useful functionality when you work with a lot of similar posts (for example products in online shop). Especially if the posts have the same custom fields values, but the different post title and content.

    It means that you do not have to re-enter custom fields, post tags and categories each time.

    This is the example:

    Duplicate post link in post row actions.

    When you click the «Duplicate» link, the post will be cloned, but it won’t be published, it will be saved as a draft and you will be redirected to the post edit admin page.

    This is enough easy to do, so, look at the following code, insert it into your theme functions.php file (or into the another file if you know what to do).

     * Function creates post duplicate as a draft and redirects then to the edit post screen
    function rd_duplicate_post_as_draft(){
    	global $wpdb;
    	if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
    		wp_die('No post to duplicate has been supplied!');
    	 * get the original post id
    	$post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
    	 * and all the original post data then
    	$post = get_post( $post_id );
    	 * if you don't want current user to be the new post author,
    	 * then change next couple of lines to this: $new_post_author = $post->post_author;
    	$current_user = wp_get_current_user();
    	$new_post_author = $current_user->ID;
    	 * if post data exists, create the post duplicate
    	if (isset( $post ) && $post != null) {
    		 * new post data array
    		$args = array(
    			'comment_status' => $post->comment_status,
    			'ping_status'    => $post->ping_status,
    			'post_author'    => $new_post_author,
    			'post_content'   => $post->post_content,
    			'post_excerpt'   => $post->post_excerpt,
    			'post_name'      => $post->post_name,
    			'post_parent'    => $post->post_parent,
    			'post_password'  => $post->post_password,
    			'post_status'    => 'draft',
    			'post_title'     => $post->post_title,
    			'post_type'      => $post->post_type,
    			'to_ping'        => $post->to_ping,
    			'menu_order'     => $post->menu_order
    		 * insert the post by wp_insert_post() function
    		$new_post_id = wp_insert_post( $args );
    		 * get all current post terms ad set them to the new post draft
    		$taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
    		foreach ($taxonomies as $taxonomy) {
    			$post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
    			wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
    		 * duplicate all post meta just in two SQL queries
    		$post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
    		if (count($post_meta_infos)!=0) {
    			$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
    			foreach ($post_meta_infos as $meta_info) {
    				$meta_key = $meta_info->meta_key;
    				$meta_value = addslashes($meta_info->meta_value);
    				$sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
    			$sql_query.= implode(" UNION ALL ", $sql_query_sel);
    		 * finally, redirect to the edit post screen for the new draft
    		wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
    	} else {
    		wp_die('Post creation failed, could not find original post: ' . $post_id);
    add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
     * Add the duplicate link to action list for post_row_actions
    function rd_duplicate_post_link( $actions, $post ) {
    	if (current_user_can('edit_posts')) {
    		$actions['duplicate'] = '<a href="admin.php?action=rd_duplicate_post_as_draft&amp;post=' . $post->ID . '" title="Duplicate this item" rel="permalink">Duplicate</a>';
    	return $actions;
    add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );

    But what if this code works only for posts, not for pages or any registered post types? Do not worry, all we need to do is to change the last filter to this:

    add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);

    Credits to:


    AUTHOR: // CATEGORY: Development, Wordpress

    No Comments

    So I had a request to add a super big menu in WordPress, and some sub menu’s and then after configuring the menu and clicking save half my menu disappeared. Apparently there is a limit that is set.

    This limit is not imposed by WordPress but by your web hosting server because of some security reasons. In PHP, there is a thing called post vars that controls menu items. By default maximum post vars are much limited as most of the websites require only a few menu items.

    It is very easy to increase number of post vars using php.ini

    All you need to do is adding a piece of code in your php.ini file. Keep in mind that different web hosts support different kind of methods and we have listed all here;

    Increasing max_input_vars

    To increase input_vars add the following code in your php.ini file

    max_input_vars = 3000;

    Note – Create a text file name php.ini and add this code to that file and place this file in your WordPress root. If your host doesn’t support custom php.ini file get their support to add this code ot php.ini file

    If your server is using Suhosin

    If your hosting server has Suhosin running, it will affect your WordPress menu limit and you need to add the following code in your php.ini file; = 5000

    suhosin.request.max_vars = 5000

    Other methods

    If above given workarounds don’t work, you can also try some other;

    1.Add php.ini in wp-admin folder

    Create a php.ini file with the below given code and put it into wp-admin folder

    max_input_vars = 3000;

    This is the one that worked for me!

    2.Add .user.ini file

    Create a file .user.ini and add the following code to it and try placing it in WordPress root or in wp-admin folder;

    max_input_vars = 5000;

    Hopefully one of the method should work for you.

    Credits to:

    Read more at:

    The WordPress Menu Item Limit or: Help! Half my menu items just disappeared!


    AUTHOR: // CATEGORY: Development, Open Source, Wordpress

    No Comments
    How to Reset a WordPress Password from phpMyAdmin

    Knowing how to reset your WordPress password from phpMyAdmin is one of the essential things you should know about because for some reason if your site is hacked, or something else, you are no longer able to login to your admin panel using the login information, and you are not able to reset the password via email, this method can be very useful. We have helped three users with the same issue therefore we have decided to do this writeup.

    Every WordPress blog uses a MySQL Database which can be accessed through your phpMyAdmin even if you are not using cPanel hosting. Follow the following steps to reset your WordPress password:

    Video Tutorial

    If you don’t like the video or need more instructions, then continue reading.

    Step 1 – Identify the Name of your Database

    It is always good to know the name of your WordPress Database. Sometimes you might be running multiple installations within the same database, then you will need to know exactly where to look for to reset the password. The best place to look is your wp-config.php file which is located in your root WordPress Directory. In there you will find the name of your database.

    Step 2 – Locating Database and Editing the Fields

    In your cPanel or other admin panel, you will need to access your MySQL database and then browse it via phpMyAdmin.

    phpMyAdmin in cPanel

    Once you are in phpMyAdmin, you will need to select the correct database on the left hand side. Look for the name that you found in your wp-config.php and click on that. You will see a list of tables with a prefix wp_ for the most part.

    If you changed your prefix during installation, then you would be looking for that specific prefix “for ex: wp673_”.

    You will look for the table wp_users, click on it and then click on the Browse Tab.

    phpMyAdmin Browse

    Click on the Pencil (Edit) Icon to reset your Password.

    phpMyAdmin Edit

    Now you will see a field that looks like this:

    phpMyAdmin Edit field

    Edit the user_pass field value. You will notice that there are a lot of random characters in the password field. Due to security reasons, WordPress stores the passwords as MD5 Hash rather than Plain text.

    This means that you will not be able to enter plain text as the password. You would need to use one of the MD5 generators online to generate your password.

    Recommended Tool: JavaScript MD5

    Simply type your password in that tool and generate MD5 results. Copy and paste the code you get from the converter into your phpMyAdmin field and click Go to save changes.

    You have now successfully changed your WordPress Password from phpMyAdmin.

    All credits to


    AUTHOR: // CATEGORY: Open Source, Wordpress

    No Comments

    CSS Classes

    CSS Classes are an advanced menu property that allow you to apply a CSS class to individual menu items. Turn on the CSS Class capability by clicking the Screen Options drop down at the top-right of your screen, and check the box for CSS Classes:


    For some themes, like Soundcheck, there is existing CSS in the theme that will convert your menu item to a photo. All you need to do is add the class to a custom link that the theme documentation refers to.

    If you are looking to implement your own CSS styling on your menu items, you will need plan which includes advanced customization.  In the above example, you could then stylize the link with the selector .twitter in your CSS.



    AUTHOR: // CATEGORY: Development, Open Source, Wordpress

    No Comments

    So, a client of yours says they like a site, and we should model something similar.

    If the site is on WordPress I use to extract the theme, and plugins running. This gives me a good idea of where to start.

    Give it a try.

    Happy theming …



    AUTHOR: // CATEGORY: Development, Open Source, Wordpress

    No Comments

    How to add Google AdSense to WordPress?

    With WordPress you can easily add your AdSense code to your blog. In order to do this, first login to the administrative end of your website. Then, go to the Appearance -> Widgets menu.



    In this page select to drag-and-drop a “Text” widget onto your registered sidebar.



    Then you should add a title (in our case – Advertisement) and right under it the actual code that you have obtained from Google. Finally, click on the on the “Save” button right under it.



    Well done! You have just added your AdSense code to your WordPress blog.

    Credit to