How can I pass php code as a content while publishing a post

I will give you a simple example, which you can modify for your purpose. save_weather_field This function will add/update/delete any post meta (in case you will decide to add more weather fields). We will use it inside post save action below. function save_weather_field($post_id, $key, $value) { //new value we pass in this function $new_meta_value = … Read more

WordPress loading all local images from specific directory?

get_stylesheet_directory was necessary for the glob function to work, you need a combination of both, e.g. fetch the files in that directory: $imagePath = get_stylesheet_directory() . “/IMAGES/sponsors/”; $filesList = glob( $imagePath . ‘*.{JPG,jpg,PNG,png}’, GLOB_BRACE ); and display the files at that URL: $imagePathURL = get_stylesheet_directory_uri() . “/IMAGES/sponsors/”; … echo ‘<img src=”‘ . esc_url( $imagePathURL . … Read more

copy fields value to another field

You do not need to, instead add the user URL column to the list of searchable table columns https://developer.wordpress.org/reference/hooks/user_search_columns/ Which includes a user contributed example that does this: https://developer.wordpress.org/reference/hooks/user_search_columns/#comment-4605 add_filter( ‘user_search_columns’, ‘wpdocs_filter_function_name’, 10, 3 ); function wpdocs_filter_function_name( $search_columns, $search, $wp_user_query ) { $search_columns[] = ‘user_url’; return $search_columns; } With this, no syncing to a URL … Read more

meta_query search names when they have middle initials

The easiest approach in such cases is to set some other custom field which you’ll use for searching. So if the name looks live that: <first_name> <initial> <last_name> Then you can create another field which will contain: <first_name> <initial> <last_name>#<first_name> <last_name>#<last_name> <first_name> (The # character is a separator, so you should use any character that … Read more