Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
1answer
12 views

Filter get_page_by_path()

Is there a way to filter get_page_by_path()? I am trying to allow duplicate slugs for pages, so that two pages can have the same slug if they have different meta value for a specific meta key. Thanks ...
1
vote
1answer
26 views

Using a filter with multiple parameters and $this

I have seen various questions about this but I am unsure how to apply those methods in this particular case. I am trying to add a filter to a plugin which returns output with the apply_filters hook: ...
0
votes
1answer
19 views

Distinguish between page and post in function

I'm trying to apply some text to the "Featured Image" box. It works fine for a custom post type, but I can't get a specific piece of text appearing on pages rather than posts. add_filter( '...
0
votes
1answer
15 views

How to remove X-Frame-Options: SAMEORIGIN" from WordPress?

I want to temporarily remove X-Frame-Options: SAMEORIGIN and need to allow all domains. I have already tried the following ways. Removing send_frame_options_header from ./wp-includes/default-filters....
0
votes
0answers
10 views

Update / refresh mini cart, after custom AJAX add_to_cart event

I need help In my custom single-product.php template, I added the button public function AddToCartButton() { global $product; if($product->is_type('variable') || $product->...
-1
votes
0answers
16 views

Why does my sidebar module (with widget for product filtering) in wordpress divi builder not filtering my shop module

I am using Product Filter by Nexter in my Wordpress (Divi Builder) website. It works perfectly with the default shop page of my website, but I encountered a problem when I make another page and add a ...
0
votes
2answers
27 views

Change text string in a plugin

I'm using the WooCommerce Waitlist plugin, but I'd like to change it to be for products that haven't been released yet, ie for "expressions of interest". To do this I need to change a lot of strings, ...
0
votes
0answers
18 views

How can I change WPML settings programmatically?

I'm trying to change WPML settings programmatically, as suggested in these posts: Disable auto sign-in programmatically Overriding the WPML settings My goal is to disable a WPML's feature that ...
0
votes
0answers
13 views

Changing the “Post Published. View Post” admin notice message after running `wp_insert_post_data` filter

I am running a validation logic for when a user is attempting to publish a post, the validation is made possible using wp_insert_post_data filter. If a user wish to publish a post, the filter will ...
0
votes
1answer
14 views

WP meta_query args not working in function

I have three query args for filtering posts in grid. By Author and Status works fine, but ACF meta_query not work. I setup field as select: http://prntscr.com/pi6m66 I need when is selected "Ne" ...
0
votes
3answers
37 views

Add filter for specific post type only

My filter works good, but for all pages and I need add filter only for specific post type. I try it via is_singular, but not work. My code: function my_super_filer_function6($query_args){ if (...
0
votes
1answer
20 views

How to add custom checkout field in user details mail template

I need to add custom field from my checkout page to email templates. I already added custom input at checkout page and it shows up in mails but it shows up after products table and I would like it to ...
1
vote
1answer
16 views

Using Ajax to load more posts | Help me change the wording on my button to notify the user

I am having bit of a brain melt situation trying to carry across a style of code I used on a previous website where I would change the wording on the button the user clicks to load more. I have ...
0
votes
0answers
10 views

Filtering custom taxonomy category on admin side

Is there any hook, or maybe there is already a plugin for that. The problem: There are lots of categories and it is difficult to find through so many pages. I need: A dropdown selection filter which ...
0
votes
1answer
26 views

Modify Contextual Help

Currently I have searched a lot of pages and information covering the contextual help tab (much like here:: 50787, 51861, 77308. Search term:: centextual help), and while there are many useful bits ...
1
vote
1answer
11 views

Filter users by custom colum not meta key

I want to add custom filter with a custom column from users table not a metaKey. I find this function to filter by a metaKey: add_filter('pre_get_users', 'filter_users_by_job_role_section'); ...
0
votes
1answer
26 views

Conflict calling an add_filter() twice

'Yoast SEO' plugin has a filter to exclude posts from the sitemap: wpseo_exclude_from_sitemap_by_post_ids This is the adviced usage (from the 'Yoast SEO' official documentation): add_filter( '...
0
votes
0answers
11 views

Show all best selling products using FacetWP

I am using FacetWP plugin in my Woo Commerce shop page. In WooCommerce we can show the best selling products by using the shortcode [best_selling_products]. Using the FacetWP, how can we show the same ...
0
votes
1answer
19 views

How to bind each “the_content” elements to a custom variables

I'm implementing bootstrap theme into wordpress and i need you'r help. In Wordpress i created a simple page with paragraph and a list of 3 item's. Product list one Product one - Link Product two - ...
0
votes
1answer
32 views

How to strip out javascript in wp_posts `post_content`

My website is undergoing an SQL injection attack redirecting to ad site dolohen[dot]com. I need to strip out the javascript before it is served up. Is there a filter I can add or update to remove ...
0
votes
0answers
14 views

Display posts from today and future in Elementor 'posts widget'

According to Elementor documentation https://developers.elementor.com/custom-query-filter/#Multiple_Post_Types_in_Posts_Widget I need to display future posts including the post from today. We want to ...
0
votes
0answers
14 views

Right filter for rewriting page statuscode

I am new to developing wordpress plugins. But I am looking to write a fairly simple plugin. I want to write a plugin that rewrites the returned status code based on some logic that consults a ...
0
votes
1answer
19 views

Unable to defer loading of jquery

I have two render blocking JS from wordpress core. jquery.js and jquery-migrate.min.js. Following this answer on WPSE I was able to add `defer="defer"' to the script tag that calls for jquery-migrate ...
0
votes
1answer
20 views

How to use do_shortcode_tag to modify the output of a shortcode?

I would like to add shortcodes whose content gets processed by plugins before it gets displayed in the page. In particular, I have a plugin which processes content between two $ signs to produce math ...
0
votes
1answer
16 views

Wordpress - Form does not filter the results of taxonomies

I created a plugin that uses an array, specific to which posts I want to give my taxonomy so that I can create custom categories, the name of this taxonomy is: categoria We are talking about an event ...
0
votes
0answers
24 views

Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”

I created a plugin to add a new stock status to my woocommerce products. I used this as my reference (copy and pasted into my plugins php file): Create WooCommerce custom stock option that is non-...
0
votes
0answers
24 views

How can I filter same content in page

I have website in wordpress have 2 pages Catalogues and Projects. The problem as the content is the same in both pages, so I would like the administrator can select what content goes in each page, ...
0
votes
1answer
14 views

Changing title using filter not working with argument

I'm trying to change my custom page's title and I'm able to do this with this function: add_filter('the_title','change_title'); function change_title($data){ global $post; return 'Page ID ' . ...
1
vote
1answer
17 views

Passing an array from shortcode-function to filter-function

This might be a php question more than it is a wordpress question. I am not sure though, but please guide me if so. I am working on a trial plugin that I use for my training in the first stages of ...
0
votes
0answers
11 views

How change post_from with query filter?

Hi i m tring to ovveride a plugin query to database. I m succeded to change post_where in this way. remove_filter( 'posts_where', 'gmw_ps_pt_query_keywords', 20 ); add_filter( 'posts_where', '...
0
votes
0answers
10 views

Post title only for front/blog page, category, archive, search etc

On any standard blog page dedicated to listing posts (i.e front, blog, category, archive, search etc.), I want to show just the post title rather than the post content. Example of desired output: &...
0
votes
1answer
32 views

Archive Widget - Count only parent posts

I'm currently using a filter applied to the Archive Widget. It's successfully filtering posts from the specific category (26) but now I also want to filter only PARENT posts, in order to count only ...
0
votes
0answers
12 views

How to hide html tags on revision comparison pages?

I can see the html tags on post revision comparision page by default. Is there any filter or other method which will be helpful if I want to hide those html tags? I just want to use this comparision ...
0
votes
1answer
30 views

Remove style tags from head

is there a filter for removing style-tags from the <head></head> area in wordpress? I want remove this style for instance: <head> <style> @import url('https://...
0
votes
1answer
22 views

Is it possible to apply_filter on a wp_ajax_ action?

I'm extending someone else's plugin with an AddOn and register it on their 'AddOn' page with an apply_filters .... (if possible) Their plugin works with Ajax calls on plugin page admin, so when I ...
0
votes
0answers
33 views

Nested Actions and Filters

It is possible and a good practice to combine filters and actions, it is necessary to take into account the order in which they are executed, a graphic example https://images.app.goo.gl/...
0
votes
1answer
24 views

Filter for author list in gutenberg core editor

Is there a filter to modify the presentation of certain editor editor components? For my example, I want to be able to filter the author list which is a select input in the Gutenberg editor on the ...
2
votes
1answer
20 views

merging an array to an existing array using add_filter

I'm working on a plugin and i want to be able to extend some of the functionality using apply_filters(). I have a setup like this which is the default values; print_r( apply_filters( '...
0
votes
2answers
35 views

Add filter return false not working

simple issue but i need some help because i dont why i m wrong on this... The apply filter (Important, this is in construct Class): if ( apply_filters( '...
0
votes
0answers
7 views

How to enable XSPF files on upload ? & mime types issue

i'm trying to allow XSPF uploads in Wordpress through a plugin: function enable_xspf_uploads($mime_types){ $mime_types['xspf'] = 'application/xspf+xml'; return $mime_types; } add_filter( '...
0
votes
0answers
23 views

how to output HTML tags in post_content and not as plain text

Currently I have a post with <strong> and <em> tags, and <p> tags. But they all seem to be being outputted as plain text, and not formatted HTML I am using laravel blade as my ...
0
votes
1answer
16 views

add_action with associative array

I am trying to get these parameters from the do_action placed inside body: do_action( 'custom_action', array( 'product_id' => $product_id , 'outbiddeduser_id' => $outbiddeduser, 'log_id' =>...
0
votes
1answer
28 views

How to change menu structure?

When we show the menu using wp_nav_menu, it creates menu with a structure like this: <div class="container"> <ul class="list"> <li class="item"> <a class="link" href="...
2
votes
1answer
61 views

Check if a filter or function has been already been called

Is there a way in WordPress to check, on a screen load, if a filter has been called or a function has run? I seem to recall some way to do that, but don't recall the specifics. A filter is being ...
1
vote
0answers
22 views

Limit entries number on network/sites.php

in order to limit the memory usage of my page, I need to limit the entries number on the page sites.php (for network management) I tried to a filter with $pagenow == sites.php but that didnt work. I ...
2
votes
1answer
34 views

Sensei LMS Hooks to Remove Content

The Sensei LMS single-course.php template has this action: <?php /** * Hook inside the single course post above the content * * @since 1.9.0 * * @param integer $course_id * ...
1
vote
1answer
17 views

When to call add_filter

I am using wp_video_shortcode_override filter in one of my plugins. I would like to make this as on option top user so its not active by default. I have set up following scenario. I need to call wpdb ...
0
votes
0answers
21 views

Filter orders in Admin area based on logged in user

I have a booking store which uses custom user roles to separate different user types. One of the user types is an 'agent' who makes orders on behalf of end-customers. I've successfully set up the ...
0
votes
1answer
24 views

Use action, filter, or hook to append HTML to WordPress plugin function

I am new to WordPress actions, filters, and hooks, and am wondering if it is possible to use one of the three to append some HTML to a defined plugin function using the theme's functions.php file. The ...
0
votes
1answer
13 views

Search with filters

I want to create Three Filters in the search form with three different filters as (Tags, categories and posts). Is it possible to create those filters? If possible means how can I create that? ...