Enable errors PHP WordPress 5.2

You can disable this behaviour by setting WP_DISABLE_FATAL_ERROR_HANDLER to true: define( ‘WP_DISABLE_FATAL_ERROR_HANDLER’, true ); This will stop the “The site is experiencing technical difficulties” message from appearing, so errors will appear as they did prior to this feature being added.

Adding featured image via PHP

Use the set_post_thumbnail function. set_post_thumbnail( $post_ID, $thumbnail_id ); Require you use WordPress 3.1.0 or later. You need call this function after you have successfully created your post via wp_insert_post and have a valid $post_ID.

the_author_meta not working

It’s entirely possible that you are calling the_author_meta() from outside of your post loop in the author.php template in which case the above will not work. Instead, you can use get_the_author_meta(‘facebook’) or… get_the_author_meta(‘facebook’, $user_id) where $user_id is the ID# of the current user/author. To get the user ID you can do this; <div class=”user_social_icons”> <a … Read more

Audio tags around Mp3 URL in content

Filter the_content ond/or the_excerpt and replace audio URLs that are not an attribute value already. Example: add_filter( ‘the_content’, ‘wpse_82336_audio_url_to_shortcode’, 1 ); add_filter( ‘the_excerpt’, ‘wpse_82336_audio_url_to_shortcode’, 1 ); function wpse_82336_audio_url_to_shortcode( $content ) { # See http://en.wikipedia.org/wiki/Audio_file_format # Adjust the list to your needs $suffixes = array ( ‘3gp’, ‘aa3’, ‘aac’, ‘aiff’, ‘ape’, ‘at3’, ‘au’, ‘flac’, ‘m4a’, ‘m4b’, … Read more