Articles of php

Image rotation issue (horizontal picture uploading as vertical) — Exif issue?

I am building a classifieds site on WordPress where users can upload their ads/images from front-end. However, when horizontal pictures are uploaded, they upload as vertical. I looked into the issue and found the following suggested solution for fixing image orientation using its Exif data: //read EXIF header from uploaded file $exif = exif_read_data($_FILES[‘ImageFile’][‘tmp_name’]); //fix […]

$wpdb->get_results breaking page?

I’m trying to generate a list of years that have posts on a WordPress page using a “php in posts” plugin that has a shortcode. but the code I’m using seems to break the page. What could be the issue here? [insert_php] $years = $wpdb->get_results( “SELECT YEAR(post_date) AS year FROM wp_posts WHERE post_type = ‘results’ […]

php – Plugin/theme relative PATH/URI

I would like to get relative path from a php file without knowing the absolute path. I have succeeded to do it but for a reason which I don’t know, on some servers (in rare case) it doesn’t work when I enqueue css/js. Slashes are missing… Here the code: define(‘PATH’, trailingslashit(str_replace(‘\\’, ‘/’, dirname(__FILE__)))); define(‘URI’, site_url(str_replace(trailingslashit(str_replace(‘\\’, […]

How to stop or remove an action being called inside a function of an extended class

The Problem I am trying to remove an JSON+LD block being added by a WordPress plugin called The Events Calendar. I believe it is being added by the function called: Tribe__Events__Template__Single_Event within which the function named google_data_markup is responsible for the actual markup which I am trying to stop/prevent from being added to the HTML. […]

WordPress cron is running with previously set time intervals and not the updated one

For testing purposes I keep short time intervals for cron and when the functionality is working fine, I change it to the required time interval. Whenever I change the time intervals for ex: from ‘three_days’ to ‘five_minutes’ or from ‘five_minutes’ to ‘fifteen_minutes’, the cron is running with earlier frequency and not the updated one. I’m […]

'pre_user_query' interfering with user export

I needed to add sortable columns to clients wordpress for custom meta data I created so I used a pre_user_query hook add_action(‘pre_user_query’, ‘user_column_orderby’); function user_column_orderby($user_search) { global $wpdb, $current_screen; if ( ‘users’ != $current_screen->id ) return; $vars = $user_search->query_vars; if(‘Kön’ == $vars[‘orderby’]) { $user_search->query_from .= ” INNER JOIN {$wpdb->usermeta} m1 ON {$wpdb->users}.ID=m1.user_id AND (m1.meta_key=’gender’)”; $user_search->query_orderby […]

Order a WP_Query by meta value where the value is an array

I have a WordPress custom query: $args = array( ‘posts_per_page’ => 2, ‘meta_key’ => ‘pworks_popular_posts’, ‘paged’ => $page_nr ); $query = new WP_Query($args); if($query->have_posts()) { while($query->have_posts()) { $query->the_post(); $pworks_post_meta = get_post_meta(get_the_ID(), ‘pworks_popular_posts’, true); $pworks_post_list[get_the_ID()] = $pworks_post_meta[‘Post visited’]; } } I am using this method to sort an array of post ids and post visits which […]

Remove   in post content

I have been trying to figure out since yesterday on how I can remove the code   on my post. In the WYSIWYG editor it shows spaces, but once after I publish my post, it shows words sticking together and also replacing the space with &nbsp. I have screenshot of my problem. Here is a […]

Is it possible to add a custom page to a free WordPress site?

I’m trying to add a custom page to my WordPress website. I found this link, which says that I need to add the template to the theme folder, but I have a free WordPress website, so I don’t have access to that folder :/ Is it possible to add a custom page to a free […]

Required PHP version: 5.3.3 – Version found: 5.2.17… How or where do upgrade to 5.33

HI I am getting this error message when trying to activate simple google cal…Required PHP version: 5.3.3 – Version found: 5.2.17… How or where do I go in wordpress to upgrade to PHP version 5.3.3? thanks, I am a rookie 🙂