New answers tagged

0

To avoid that error, you have to add something in your function like: add_filter( 'woocommerce_email_recipient_new_order', 'tm_destinatario_condicionado_wc', 10, 2 ); function tm_destinatario_condicionado_wc( $recipient, $order ) { // To avoid an error in backend if( ! is_a($order, 'WC_Order') ) return $recipient; $estados = array( '...


0

You could try this see if any different: <p> <?php $label = apply_filters('cm_tooltip_parse', 'Label: ', true); if ( generate_show_title() ) {$title = get_the_title();} else {$title = '';} echo str_replace( array( "\n", \r"), array( '', ''), $label . $title ); ?> </p> If that works, cm_tooltip_parse or generate_show_title are probably ...


0

Option 1: force featured image on all posts Use the save_post hook, which runs twice per "save" action if you have revisions enabled. You can verify it's the final run by checking that there is $_POST data (it's empty the first time around). add_action('save_post', 'wpse_force_featured_image', 20, 2); function wpse_force_featured_image($post_id, $post) { ...


0

Rather than just no-indexing the Page, 301 redirect it. This can be done either by server config (.htaccess, NGINX rules, etc.) or using a plugin. That way no one can actually get to the Page all on its own - it only exists on the front page.


3

So if i understand you correctly, you want to sort by a value that has to be calculated based on the currency? You can do this, but not within a wordpress wp_query of sorts. Instead you can do one of two things: Method 1: The "do more now, have less hassle later"-way: On saving the currency and price in your save_post action, you calculate the AED-price ...


0

I would definitely recommend the Custom Post Type route. You will have two issues: How to automatically add new properties when the XML is updated. How to update existing property values if they change (e.g., House A has a price increase after the initial import). To solve the first, you can set up a WordPress cron that will hook into your import action....


0

No, constructors should not define hooks. Constructors should be used to set the initial state of the object. Hooks have nothing to do with the object's initial state, so they don't belong in the constructor. Constructors should not have "side effects", so that using new ClassName() does not affect any other parts of the program, which is what registering ...


-1

it depends on what you want to do. for example, suppose your plugin needs javascript for it to work. in this case, we can enqueue the javascript in the constructor of the Class : class My_Plugin{ function __construct (){ add_action( 'wp_enqueue_scripts', array( $this , 'my_script' ) ); } function my_script(){ // here ...


0

I know this question was solved, but this plugin is out and solved my problem https://wordpress.org/plugins/wp-rest-filter/


0

You can except to go to that logout page. Only you need to change your logout link in your frontend. <a href="<?php echo wp_logout_url()?>">logout</a> this code, make the logout without confirmation window. But also if you really need a confirmation, you can create a "new page" named "confirmation" now, in your frontend the logout can ...


0

In your jQuery you have jQuery('.post-tags select').on('change', function(event) { but when I look at the source code of your page the dropdown is <select id="dropdown_select" class="dropdown_options">, I don't think your script is watching the correct item. Try correcting that in conjunction with the other answer and see if that has an effect.


1

You can't just filter __FILE__. Or any arbitrary function or variable. You can only filter values that are passed to apply_filters(). In this case the wcpv_vendor_order_page_template filterable value is: dirname( __FILE__ ) . '/views/html-vendor-order-page.php' In other words, it's a path to a PHP file. If you want to change the PHP file that's loaded, you ...


0

I find and use below code for when user in cart page and cart not empty: add_filter('woocommerce_get_checkout_url', 'dj_redirect_checkout'); function dj_redirect_checkout($url) { global $woocommerce; if(is_cart() && !is_user_logged_in() ){ $checkout_url = 'digits login url'; } else{ $checkout_url='https://...


1

Not really, but perhaps you using the wrong terms: A shortcode is a manually entered piece of text where code has been programmatically added so that when wp runs 'the_content' filter , it'll then call the function and replace the piece of text with the returned result of the function. It's a specialised form of a filter. It sounds like what you want is ...


0

Thanks for your answers. According to comments above, I modified my code. Now it works. Is it correct way? <?php /* Plugin Name: Test plugin */ $arr = []; add_action( 'init', 'set_var_data' ); function set_var_data() { global $arr; $arr = [ 'val', 'val2', 'val3' ]; $arr = apply_filters( 'my_hook', $arr ); } ...


0

https://parquedasfeiras.online/wp-json/wp/v2/job_listing?job_listing_category=86 Simple solution, worked for me. I believe I'm sleepy.


1

I realize you've already answered your issue. However, I think there is some additional explanation possible to give more clarity to the issue and the solution. The issue is your lqdnotes_add_div() function. This is hooked to a filter - the_content. In WordPress, any time you use a filter, your filter function must return a value for the item being ...


0

StackOverflow may be my rubber duck. Almost immediately after publishing the question the solution popped into my mind. The problem was in the function lqdnotes_add_div. This function took $content (the post content) as a parameter. If post was not of type lqdnotes then it didn't perform any operation on $content...or so I thought. PHP actually returns ...


1

I haven't played too much with Gutenberg, but I'll most likely need to solve something similar in the future, What i'd do, is just edit the function directly, for a quick debug. const rawTransforms = getRawTransformations(); const phrasingContentSchema = getPhrasingContentSchema( 'paste' ); const blockContentSchema = getBlockContentSchema( rawTransforms, ...


0

I think the value would only be present if you add the get-param to the url when trying to preview it ( or specifically set a value for the query-var using $query->set() ) Try adding ?xyz=hello-world to the end of the url you're testing on & you should see hello-world in the dump. It will also depend on where you dump... maybe try this: add_filter(...


Top 50 recent answers are included