New answers tagged

1

I solved this issue after Rup in one of the comments pointed out that the parent categories dropdown was most likely the culprit. Sure enough, that was the issue. It appears WordPress was attempting to populate the dropdown with 15,000 items which were causing an excessive query to be made to retrieve those items. The simple fix in my instance was making my ...


0

My mistake, $value['afg-original-price'] wasn't defined each time.


0

I had to change this: 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'cpt', ), ), ),


0

Here is a great post by Austin Ginder: https://anchor.host/acf-custom-fields-stored-in-custom-table/. I've also come up with a free plugin: https://wordpress.org/plugins/acf-fields-in-custom-table/


0

Your theme needs to reference the custom fields from the backend, they aren't included in <?php the_content();?> EG: If the custom field is a text field your theme will need something like: <?php the_field('name_of_custom_field'); ?> I'd suggest you look at the docs located here: https://www.advancedcustomfields.com/resources/


0

This article walks you through creating a very basic, lightweight plugin to add your own meta fields. I'm sure it could be adapted to be used as a standalone function rather than a plugin. https://metabox.io/how-to-create-custom-meta-boxes-custom-fields-in-wordpress/ Essentially you add your fields using add_meta_box() and setting the post type to post or ...


1

You can use the custom fields included in wordpress Add a new post and do the following steps: 1. Go to the Options page 2. Select "custom fields" and hit the reload button 3. you now have a custom field in your post edit page at the bottom. now you can use this custom field in your theme inside the post-loop <?php while ( have_posts() ) : ...


-1

Try this Custom Meta Boxes But I usually using plugin Meta Box because it is easy to use.


0

Instead of showing custom field with text, create a custom field with select dropdown. Populate that dropdown options with get_terms function (term_id as value) Add multiple attribute to select if you need to store more than one term relation. Store values as array of term ids On frontend loop trough saved array and use get_term function to get term ...


0

You can use ACF (Advanced Custom Fields) plugin to do this. Select Taxonomy field and set the field group to appear where you need to. I'm pretty sure the free version of the plugin has this field.


0

You have to add following code after your code to get the dates sorting correctly. It's working correctly for me. Hope it will help. function change_user_order( $args ){ if( isset( $args['orderby'] ) ) { $args['meta_key'] = $args['orderby']; } return $args; } add_filter( 'users_list_table_query_args', 'change_user_order' );


0

Instead of using the pre_get_posts hook simply modify your WP_Query to fetch posts with certain conditions. $loop = new WP_Query( array( 'post_type' => 'projects', 'orderby' => 'rand', 'posts_per_page' => 1, 'meta_query' => array( array( ...


0

Am I using this hook incorrectly No, you're not. is there another way to get the ID? Yes, try this: function add_menu_field( $item_id, $item, $depth, $args, $id ) { $id2 = 0; if ( ! $id && isset( $_GET['menu'] ) && $_GET['menu'] ) { $id2 = absint( $_GET['menu'] ); } elseif ( ! $id && ! isset( $_GET['menu'] )...


0

It looks like the category name. Really, I don't understand what you mean? For Vietnamese: Hỏi trên này để có câu trả lời là lâu lắm. Tham gia nhóm WordPress Việt Nam mà hỏi, có khi còn nhanh có đáp án hơn ở trên này. Link group: WordPress Việt Nam


0

$args = array( 'post_type' => 'custompost_type', 'posts_per_page' => '1', 'meta_query' => array( 'relations' => 'AND', // you can use OR also as your requirement array( 'key' => 'serial-number', 'value' => '123' )...


0

if your meta value is not numeric for example if it is a date value; than you can add parameter meta_type => DATE. Possible values are; 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. Query with meta type will be like that: $args = array( 'post_status' => 'publish', 'post_type' => 'listing', 'meta_key' => ...


-1

Maybe someone else has this issue, I found this! https://wordpress.org/plugins/navz-photo-gallery/


1

Here is the code based on custom SQL query as suggested by @Rup that should work for you: // get '-1 month' and '+2 month' dates as an array('YYYY', 'MMDD') $before = str_split( gmdate( 'Ymd', strtotime( '-1 month' ) ), 4 ); $after = str_split( gmdate( 'Ymd', strtotime( '+2 month' ) ), 4 ); // if the before/after years are the same, should search for date &...


0

I believe since ACF stores the values as Ymd you have to write some kind of workaround. One possible solution could be that you hook into saving the field and additionally store the month in another meta field. This would allow to query for => and <= with the meta query. Another solution is to not store the date in an arbitrary format but one that the ...


0

When the Update button is clicked in Quick Edit the post_meta are properly updated, values saved in database, but column's content is not updated by Ajax. Indeed, the Quick Edit feature makes no attempt to update or reload individual admin columns. It instead replaces the row with whatever the AJAX endpoint returned. Here is the implementation: https://...


0

i suggest you check the the value of $checkbox by either checking checkbox under meta_key column in wp_postmeta or *your prefix_postmeta table in your database or simply do var_dump($checkbox); for testing if its 0 or null or an empty string or so then your if condition will not return true and $has_video will not be assigned to 'icon-has_video'.


Top 50 recent answers are included