syntax issue on php 7.4

Option 1 Have you tried changing the function name? something similar function getClientFn($function){}? You can keep any name you want. function getClientFn($function){ return ‘\DisplaceTech\Companies\\’ . $function; } function add_clients_metabox(){ $screens = [‘page’]; foreach ($screens as $screen) { add_meta_box( ‘clients’, // Unique ID __(‘Clients’), // Box title getClientFn(‘clients_box_html’), // Content callback, must be of type callable … Read more

get_the_terms – only top level

Just have a quick test and seems both methods working well. // @Rup’s method $terms = get_the_terms(get_the_ID(), ‘my_taxonomy’); if (!is_wp_error($terms) && !empty($terms)) { foreach ($terms as $term) { // skip if parent > 0 if( $term->parent ) continue; $name = $term->name; $link = add_query_arg(‘fwp_typ’, FWP()->helper->safe_value($term->slug), ‘https://www.freuciv.com/’); echo “<a href=”https://wordpress.stackexchange.com/questions/366690/$link”>$name</a><br />”; } } or $terms = … Read more

How to convert objects into arrays

$wpdb->get_results has a second parameter that lets you specify what kind of return value you want: For example: $data = $wpdb->get_results( $query, ARRAY_A ); Here you get an associative array back.

Custom php page outside the scope of my theme

is this not something that you could put into your functions.php file as a new function, adding the action to init to fire off on the page load? You could then put in an if statement so it only runs when specific criteria is met, such as a page ID or slug or template is … Read more

Template part inside shortcode, unexpected reult

The get_template_part() function doesn’t assume any directory name, you have to explicitly supply it. It’s also relative to the active theme directory. So in many of your examples it was looking for the template in the root of your active theme. The correct format would be: get_template_part( ‘template-parts/test-one’ ); If you wanted to, you could … Read more

How to change a public function inside a class of a plugin?

It’s not possible to overwrite the class function without modifying the file (unless your hosting supports some form of “monkey patching” as its called) you could check if this function “tve_dash_api_remote_get” has a filter in it that allows you to manipulate the uri