Linnea Huxford
  • Member for 6 years
  • Last seen more than a month ago
add_filter to modify woocommerce_cart_item_name hyperlink
6 votes

The key is to pass arguments to the callback function. Try this: /* Function that returns custom product hyperlink */ function wc_cart_item_name_hyperlink( $link_text, $product_data ) { $title = ...

View answer
How to filter users on admin users page by custom meta field?
4 votes

I tested your code in both Wordpress 4.4 and in Wordpress 4.3.1. With version 4.4, I encounter exactly the same issue as you. However, your code works correctly in version 4.3.1! I think this is ...

View answer
Get updated post meta on save_post action?
Accepted answer
2 votes

WordPress fires the updated_{$meta_type}_meta hook which fires after the metadata is updated. In your case, the hook would be updated_post_meta and you could have your function run on that hook ...

View answer
What is the best way to install a WordPress starter theme into a Docker environment?
Accepted answer
2 votes

It's easy to install a theme on WordPress. There are a couple of options, but for the underscores.me starter theme, the easiest option would be to go to https://underscores.me/ and enter your theme's ...

View answer
WP_Query for a taxonomy with different taxonomy types
Accepted answer
2 votes

You can create a taxonomy query. Assuming that "curso" is the term slug, it would look like this: $query = new WP_Query( array( 'post_type' => 'obras_en_curso', 'posts_per_page' => 4, '...

View answer
Main query not querying any posts in custom taxonomy template
Accepted answer
2 votes

I think the issue here is that when registering the post type, you've set exclude_from_search to true. See this note from the WordPress Coedex: Note: If you want to show the posts's list that ...

View answer
Does using custom taxonomy is more CPU efficient than using meta_data?
1 votes

Yes, an SQL query that is for a single taxonomy will generally be faster than an SQL query that is for a post meta value. If you just need to check whether the post meta key exists, then that is ...

View answer
'orderby' => 'rand' alternative for better performance?
1 votes

Retrieving the first post published after a random date can be achieved with a WordPress date query combined with the wp_rand() function. For the wp_rand() function, you just have to supply it the ...

View answer
WordPress Settings API - Sanitize Integer
1 votes

If the integer should be a positive number, you can use absint(). See: https://codex.wordpress.org/Function_Reference/absint

View answer
Preserve term order per post in a non-hierarchical taxonomy
Accepted answer
1 votes

I encountered a similar issue and this is how I solved it. Note that I put in Fruits as the taxonomy name based on your example. It's important that this name matches the taxonomy name exactly. ...

View answer
Only display notification on single post
0 votes

I think the solution is to check if it's the main query. WordPress has a function for that, is_main_query() The query that you're running in your related posts widget is a secondary query, so ...

View answer
disable Wordpress 404 for one specific page/folder to receive actual php errors
0 votes

WordPress has several methods for seeing PHP Errors, Warnings, and Notices. Specifically, you can set WP_DEBUG to true and enable WP_DEBUG_LOG and WP_DEBUG_DISPLAY, as per these instructions. However,...

View answer
show/hide div with simple jQuery script
0 votes

Most likely, the cause of your problem is that jQuery is in compatibility mode. This means that you can't use the '$' shortcode. To get your Javascript code to work, replace all '$' with 'jQuery' Or,...

View answer
Implementing a blog excerpt in custom theme
0 votes

It looks like your index.php file calls the content-page.php file. The code you are looking to change is probably in the content-page.php file. The key is this line: get_template_part( 'content', ...

View answer
wordpress filtering out caps in wp_title? (UpperCase is changed to Uppercase)
0 votes

It isn't happening to me (I just checked with your example), so it must be something that's occurring in the theme or a plugin. You could try searching all of the codebase for the wp_title filter, ...

View answer
WordPress Post Visibility Options for Frontend
Accepted answer
0 votes

One option is to use Ajax. I wrote this tutorial on how to use Ajax with WordPress and if you follow those steps, you'll get the general idea. Of course, you'll have to write some HTML to display ...

View answer
Change auto post title generation according to different post properties
0 votes

Use the function get_post_meta($post_id) to get the post meta data. Hope this helps.

View answer
Some code in shortcode function being ignored
0 votes

This line is your issue: $log_string += "Dealing with " . count($atts) . " tab(s)\n"; It should be: $log_string .= "Dealing with " . count($atts) . " tab(s)\n"; It looks like you confused the ...

View answer
Missing argument 2 for wpdb::prepare()
0 votes

This is how it should be written: $fields = $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_order IS NULL AS isnull FROM $wpdb->postmeta WHERE post_id=%d ORDER BY ...

View answer