update_post_meta not working in a loop
update_post_meta not working in a loop
update_post_meta not working in a loop
You can use get_current_screen() to check which page is being displayed now, and if it was your plugin’s page, enqueue the script. However the easier way is to use the global variable, $pagenow: if(( $pagenow == ‘my-plugin.php’ ) { wp_enqueue_style(‘my-style’, ‘URL-HERE’ ); } In which my-plugin.php is the slug of your plugin screen’s URL, such … Read more
Instead of doing this, simply write your own function inside the verifyapi.php and then include it in your plugin’s main file, by using this: require_once(‘verifyapi.php’); This way, you have access to WordPress’s function inside your verifyapi.php file. Now, inside your verifyapi.php file, create an Ajax handler (however I would recommend using a REST endpoint) : … Read more
To be able to approve your own plugin translations you have to post in the Polyglots site: https://make.wordpress.org/polyglots/ a message like this: “Hello, I’m the author of the {insert plugin name and a link} plugin. Could you allow me to approve translations in my native language (es_ES), please?” And select “Editor Request” in the “Post … Read more
There’s no filter for filtering all of the HTML output in the admin. The closest thing is the gettext filter: function wpse_275812_filter_text( $translated_text, $text, $domain ) { $translate_text = str_ireplace( ‘foo’, ‘bar’, $translated_text ); return $translated_text; } add_filter( ‘gettext’, ‘wpse_275812_filter_text’ ); This filters any text output by the internationalization functions (__(), _e(), etc.). So it … Read more
Doubts about the use of metadata and how this can affect performance on WordPress
See WP_Query as reference for the post query filters. You can filter posts by their authors with the ‘author’ query var as you filter posts by their taxonomy with ‘tax_query’ query var. Then, conditionally set the ‘tax_query’ query var depending on the user’s company meta field. If it’s empty, set the ‘author’ query var instead. … Read more
Answering my own question: I reviewed another well-known plugin, Google Analytics, which provides both approaches to the user: The user can either: Use the plugin’s client id and secret key to request an authorization code with offline access. The user pastes the code into a text field and the plugin proceeds to request an access … Read more
You can’t and shouldn’t echo something into a function’s arguments. The single_post_title() function will echo the title by default. You should either set the second parameter to false, or use another function: echo getDescription( single_post_title( ”, false ) ); WordPress also offers the get_the_title() function that returns the single post’s title which you can use … Read more
woocommerce_checkout_order_processed hook executing function twice