ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set

the issue I’m having is that the image data object (imgDataObj in the js), which is saved as an attribute in the JS side, is getting passed to the PHP side even though I’m not passing it in the serversiderender component and I’m not listening for it in the PHP render callback That issue could … Read more

Custom plugin icon not showing up

The dev docs are for adding an icon that the .org repository can use. You’ll note that the relevant docs are part of the “The WordPress.org Plugin Directory” section. To display an icon on the updates screen for a plugin that is not distributed through the repository you need to include the icon URL in … Read more

How to test nonce with AJAX – Plugin development

I see some issues: You ajax action can be only used by logged users. If this is correct, I recommend you add a nopriv action that returns a error message. // Inside Constructor add_action( ‘wp_ajax_nopriv_pp_html_process’, array( $this, ‘pp_html_process_not_logged’ ) ); And create this function : public function pp_html_process_not_logged () { // Status can be used … Read more

best practice for query string values – get_query_var always empty for my value supplied in query string

You get the exact unchanged value with: $event_id = filter_input( INPUT_GET, ‘event_post_id’, FILTER_VALIDATE_INT ); Here I added the validation filter directly, but you can even move that to separate code for more complex cases. WordPress’ query variable handling is for cases in which you want to allow changes to the values before they reach your … Read more

How do I dynamically render an InnerBlock inside a dynamic block?

Instead of removing the question, I’ll answer the question myself for those that seek to find the same answer. My InnerBlock was called counter-list.php, which causes a problem as I have a counter_list_render_callback function. When looping through all my blocks, it tries to find counter-list_render_callback which is an invalid function name and therefore fails to … Read more

Show User’s Current Time

If you don’t have a problem using a api you can do the following. // check if user IP exists if (!empty($_SERVER[‘REMOTE_ADDR’])) { // get user data based on IP (not always correct) $user_ip_data = file_get_contents(‘http://ipinfo.io/’ . $_SERVER[‘REMOTE_ADDR’] . ‘/json’); // check if is json object if (!empty($user_ip_data) && $user_ip_data[0] === ‘{‘ && substr($user_ip_data, -1) … Read more