What is the correct MIME type for PSD (Photoshop)

This is what I use to allow PSD upload: add_filter(‘upload_mimes’, ‘custom_upload_mimes’); function custom_upload_mimes ( $existing_mimes = array() ) { $existing_mimes[‘psd’] = ‘image/vnd.adobe.photoshop’; return $existing_mimes; }

Add custom template page programmatically

The article linked is on the right track, but i’ll make it more simple for you.. 😉 add_filter( ‘page_template’, ‘catch_plugin_template’ ); function catch_plugin_template( $template ) { if( ‘tp-file.php’ == basename( $template ) ) $template = WP_PLUGIN_DIR . ‘/yourpluginname/tp-file.php’; return $template; } The filter basically looks to see if your special page template is set for … Read more

Get list of years when posts have been published

Your question is pretty old, but I just wanted to add a real solution to your question. Here’s a function that will return an array of years you have posts published in. You can put this function in functions.php or in a plugin or whatever you want. function get_posts_years_array() { global $wpdb; $result = array(); … Read more

What is this code in my theme’s functions.php? if (isset($_REQUEST[‘action’]) && isset($_REQUEST[‘password’])

Your website has been hacked. This is malicious code that gets triggered from the outside, loading more malicious content from ‘www.dolsh.cc’ domain. If the content comes back after you remove it, then you have hacked files somewhere else that will automatically rewrite functions.php any time page is loaded. You need to find and clean up … Read more

Why does WordPress have private functions?

It is quite normal practice for code to not be a part of public API. But much of WP code is ancient and procedural. There are no technical ways to make a private function. These are semantically private, that is WP doesn’t want you to use them, but it cannot actually forbid you to. There … Read more

Is it possible to rename a post format?

I think this is the only way for now. Put this in your functions.php in your theme folder or create a simple plugin: function rename_post_formats( $safe_text ) { if ( $safe_text == ‘Aside’ ) return ‘Quick’; return $safe_text; } add_filter( ‘esc_html’, ‘rename_post_formats’ ); //rename Aside in posts list table function live_rename_formats() { global $current_screen; if … Read more

remove links from images using functions.php

add_filter( ‘the_content’, ‘attachment_image_link_remove_filter’ ); function attachment_image_link_remove_filter( $content ) { $content = preg_replace( array(‘{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}’, ‘{ wp-image-[0-9]*” /></a>}’), array(‘<img’,'” />’), $content ); return $content; } The regex could be simpler and unfortunately this also deprives you of the unique wp-image-xxx (where xxx is the attachment ID) class of the <img> tag, but it’s the safest one I … Read more