Questions tagged [filters]

A type of hook that provides a way for content to be overridden programatically

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

Add custom fields to image attributes

In short: I've added custom fields to my media library uploads. How can I add the custom field information to my images? I want to use Pinterest on my site properly. Pinterest suggests to add data-...
0
votes
0answers
28 views

How to prevent WordPress from updating the post modified date?

I asked this here because I am going to change categories for 100+ posts. But I don't want to change the modified date(I use the quick edit feature to edit posts). So I am looking a way to temporarily ...
0
votes
0answers
23 views

Add a top bar to a wordpress theme without editing the header.php file?

I would like to add a top bar to wordpress without having to edit any theme files. Are there any filters that I can use to achieve this. I want to be able to do this in the function.php file. This ...
0
votes
1answer
22 views

include specific Pages to wp_list_pages with filter

How can i make a simple filter to display only specific pages (include instead of exclude) as an output to wordpress pages widget? I made this code , but its not working function specific_pages($...
0
votes
0answers
26 views

how to unescape wordpress output

I am having to hook into a plugin and I need to actually output a value I get via jQuery. However, when I try to return it (I have to use return) it just escapes the javascript instead of actually ...
0
votes
1answer
48 views

Modify gform_other_choice_value for specific form and specific field in Gravity Forms

I am looking to change the "other" text for a single specific field on a specific form in Gravity Forms. It seems gform_other_choice_value does not work the way some of the other Gravity Forms ...
0
votes
0answers
16 views

Woocmmrce access country on woocommerce_cart_shipping_method_full_label filter

I'm tiring to add some labels to woocommerce shipping methods on checkout cart, it works fine, but i need to access customer selected county inside custom_shipping_labels function, is that possoble ...
0
votes
0answers
9 views

Can We use Add_filter inside IF statement. If use then how. I code to use Add_filter inside if statement but its not working

I code this to add 25% on the custom price of each product with a checkbox trigger in checkout. I have a problem that when I use hook ” add_filter ” inside IF statement to apply on checking it’s not ...
0
votes
0answers
8 views

How to filter wp_query by huge post_meta

I have 200 different post meta value. And i create form for filter. I catch values with $_GET value and filter with meta_query. But if i check all meta values from filter form, my server down. Because ...
0
votes
1answer
36 views

Having wp-admin on different domain

I had a wordpress wp-admin running on a different domain. In other words WP_SITEURL = 'https//admin.example.com' and WP_HOME = 'https://www.example.com' Recently I had the bad idea to updated ...
0
votes
0answers
30 views

WP_Query and Meta Query filter custom post type by capability

I am currently using WP_Query for my custom filter function of a custom post type and I would like to filter this if a user has a capability. Using roles is also an option, but it would be easier if ...
0
votes
0answers
6 views

Category list popup

I have my products categorized by the name of the cities. I want to show a popup to select the city i.e category when someone visits my shop page. Kindly Help
2
votes
0answers
20 views

What's the point of the query_vars filter?

WordPress doesn't seem to support named parameters in a query string (like ?foo=123&bar=456) unless you explicitly allow them by doing add_filter('query_vars'...). Why is this? What (presumably ...
0
votes
0answers
17 views

WP_Query filtering for a moment, then all posts are displayed?

I'm trying to use input types to filter what posts are returned on my blog. I'm also using JetPacks' Infinite Scroll functionality which could be playing a part here. This is what I have so far: ...
0
votes
1answer
13 views

Override wordpress audio playlist

To overwrite wordpress audio you would use wp_audio_shortcode_override filter and then return your own output. Is there a way to overwrite audio playlist? [playlist ids="1268,1265,1196"]
0
votes
0answers
11 views

Filter database based on map selection

I want to add a list of professionals in a country, and I want the user to be able to filter on these professionals Selecting by a category (dropdown) Also by selecting the area on the map (or this ...
0
votes
0answers
27 views

How to use third-party SendGrid Email Validation API in Gravity Forms?

Please let me know how to use SendGrid Email Validation API in Gravity Forms, using gform_field_validation filter? Gravity Forms filter example: add_filter( 'gform_field_validation', function ( $...
0
votes
0answers
17 views

WordPress Live Post Filter

I'm trying to filter posts as you type on a search bar, or filter by category on click. The blog page has all the posts, a search bar on top and a-tags to act as the category filters - just don't know ...
0
votes
1answer
16 views

Remove Comment Author Link only for subscribers

I am using this function add_filter( 'get_comment_author_link', 'remove_comment_author_link', 10, 3 ); function remove_comment_author_link( $return, $author, $comment_ID ) { return $author; } to ...
0
votes
0answers
14 views

How to add product thumbnail on orders list on backend?

I added product thumbail on cart with this function getCartItemThumbnail( $img, $cart_item ) { if ( isset( $cart_item['image'] ) ) { return '<img src="' . $cart_item['image'] . '" /&...
2
votes
0answers
10 views

How can I filter block registration based on post-type? (Block alignment settings)

I want to disable the .alignwide and .alignfull block alignment options (remove them from the editor UI) on the 'post' post-type only. I have tried using this block registration filter to modify the '...
0
votes
0answers
23 views

Use a functions in functions.php to remove a string for template theme

I want to remove a character "h" generated by code of templates of the theme. I don't want to use templates in Child Theme for that, I prefer to use a function in functions.php to remove the string in ...
0
votes
1answer
37 views

How to add a custom class attribute into code wrapper? [duplicate]

By default, after publishing codes, the post shows a html like this, <pre class="wp-block-code"> <code> some codes here </code> </pre> I have plenty posts ...
0
votes
2answers
41 views

Redirect no product url's to static url

I am trying to redirect non-existing woocommerce product's url's to worpdress page. Example: https://testname.com/product/abc to https://testname.com/sample-page here there is no product published ...
0
votes
1answer
15 views

Drop down filter sort posts by latest, last 7 days and monthly

I am trying to use a drop down for users to select and show posts made latest, last 7 days and monthly. Currently I was able to find code to just sort by date in ASC and DESC order. <div id="...
0
votes
0answers
5 views

Filter for the Post List Page

guys. I've used WordPress for a while and always want to advance the functions of my website built with WP. One function I'm working on is the post list page in the dashboard. I made a custom post ...
1
vote
1answer
23 views

How Does comment_author Filter Work?

I want my plugin to add extra text after a comment author's name. For example if they've commented as "Albert", I might want the comments section to display their name as "Albert (genius)". I'm ...
0
votes
1answer
19 views

How Do I Unhook This Parent Theme Function?

In a parent theme I have a function like this, that removes hyperlinks from comments: function preprocess_comment_remove_url( $commentdata ) { //some code... return $commentdata; } ...
0
votes
1answer
158 views

Can't display posts by filtering categories using isotope.js

I am currently building a wordpress theme using the isotope.js script which allows you to display articles on the same step by filtering their categories, I struggled a lot and I still can't get the ...
0
votes
0answers
56 views

How to add woocommerce product price filter widget to other page

I had actually customise page ( which totally override by Attribute page template type), And I want this page attche woocommerce widget "Filter product by price" As I add shortcode: [...
0
votes
0answers
36 views

remove_filter function to unhook twentysixteen parent theme function

I've used the following code in my child theme function.php to remove custom image and thumbnail size attributes function remove_parent_function_img_size_attr() { remove_filter( '...
0
votes
0answers
19 views

Hook to add content after date in post?

This code function test($the_date) { return $the_date . 'after'; } add_filter ('get_the_date' , 'test'); adds 'after' after the date, which is what I want. But it adds it inside the date link tag....
0
votes
1answer
61 views

Change user nicename without sanitize

How to remove sanitize from edit_user_profile action? I have a possibility to change user_nicename with the following code: function ex_insert_nicename_input( $user ) { $content = ob_get_clean();...
0
votes
0answers
16 views

How to preserve block formatting when using 'the_content' filter to modify content for a single post?

I need to modify the content of a single post page before it's published. I'm using the default TwentyTwenty theme to test my code, and a lot of the content is in block format. Here is my code: ...
0
votes
0answers
10 views

Woocommerce filters on top of the page

I need to put filters on top of the page produts similar like this: https://www.wayfair.com/bed-bath/sb0/sheets-pillowcases-c431080.html Anyone knows any plugin or custom code? Really appreciate your ...
0
votes
0answers
22 views

Category filter in the archive

I want to display in the page.php all category (now it's do it) but when i click to a specific category, then it's go to the archive.php and dipslay me all category again, but i want display the post ...
0
votes
0answers
17 views

Updating Post Hang/503 error

I am trying to copy the WooCommerce Description (post content) to the Short Description (excerpt) on post save. My current solution is: /* Do something with the data entered */ add_action( '...
0
votes
0answers
21 views

Checking for post_meta before using hook wp_insert_post_data

This works well but I am trying to check for post_meta before processing the hook. This script is based off this thread: Force Custom Post Type Status to 'Future' on first Save or Publish ...
0
votes
1answer
51 views

Function not returning correct value for found_posts filter

I am trying to return found_posts value minus the offset and I am not getting the expected pagination. function homepage_offset_pagination( $found_posts, $query ) { //Define our offset again......
0
votes
0answers
17 views

Hook for after content field, not the_content

Is there a hook to insert code after the standard content field? Not 'the_content' hook, which encompasses the entire content, including all the custom fields. Just the content field text, I would ...
0
votes
0answers
8 views

Pluggable function vs apply_filter for performance

There's a pluggable function and there are filter hooks inside the function. if( ! function_exists('function_name')) { ... apply_filters('hook_name', 'callback funtion'); ... } Which is better ...
0
votes
0answers
35 views

How can you modify the jetpack infinite scrolling query based on the page you are seeing?

I am trying to implement infinite scrolling on my theme, in my site, some pages use the regular sorting, some use reverse sorting and some use custom loops, I would like to add infinite scrolling to ...
0
votes
0answers
11 views

How can I pass instance via apply_filters as a parameter?

How can I pass instance via apply_filters as a parameter? $dt = new DateTime("now", new DateTimeZone($timezone_string)); $d = apply_filters( 'custom_date_format', $d, $dt ); UPDATE: It's my mistake. ...
0
votes
1answer
28 views

White page by using filter template_include

I working on my plugin and tried to override some templates. If I visit the page portfolio my screen gives a whitepage. This is my code define("PLUGIN_DIR_PATH", plugin_dir_path(__FILE__)); ...
0
votes
0answers
52 views

Adding a css class using add_filter to comments-header

I want to custom style the header of comments on a post... add_filter('the_title', [__CLASS__, 'replace_title_if_locked']); Then the function public static function replace_title_if_locked($...
0
votes
0answers
17 views

SQL Joins not getting correct columns

I'm trying to alter the main query via posts_where & posts_join, in order to select the following: Orders (post-type) that have meta_key='_customer_user' that is >= 1 (can do this via standard ...
0
votes
0answers
15 views

“Portfolio” filter in Pure theme filtering more than one category at a time

I downloaded this theme which looks amazing. If you click on the filter it filters the posts by category. I installed it and I noticed this filter is called "portfolio". I implemented it and looks ...
0
votes
0answers
13 views

Create filter for subcategories

So, i tried to display all post based on category. I have 3 filters and each is inherited. what i want to have is, if i only put only first parameter, then return all post based on first parameter, ...
0
votes
1answer
29 views

Any way, hook to add content right before the “read more” link?

I'm trying to add the 'Hello world' from this code: add_filter( 'the_content', function( $content ) { return $content . ' <br /> Hello World '; }, 0); Before the "read more" link that that ...
3
votes
0answers
84 views

Remove left alignment option in core/image block

I’m trying this code to disable the left alignment option from the core/image block. I just want to make available the center and right alignment options. wp.hooks.addFilter( 'blocks....

1 2
3
4 5
54