Questions tagged [filters]
A type of hook that provides a way for content to be overridden programatically
2,999
questions
0
votes
1
answer
15
views
Filter hook for the action of listing users
I need to modify the list of users return on the 'All Users' admin page. I am producing a list by having added the list_user capability to the author role and this has produced a list of users. Now I ...
0
votes
1
answer
55
views
'apply_filters' is breaking some shortcodes/HTML but not all
I am using AJAX to periodically reload the content in an article in order to create a 'live' page.
This works fine for plain text and some basic HTML. But other HTML and shortcodes I add to the ...
2
votes
1
answer
13
views
Modify upload directory to use post category slug in file path on multisite installation
I am using the default post type and category taxonomy to manage the content on an in-development website that is using WordPress multisite. There are categories defined like "bylaws" and &...
0
votes
0
answers
9
views
AAPF Filter group is not in widget section
as i am trying this plugin for my website AAPF Filter group is not showing in my widget section, if i use this short code also it doesn't working [br_filters_group group_id=2661]
0
votes
0
answers
10
views
how to append ACF field data using one of the following filter/ hooks
using a plugin which lists the following as filters/hooks to append data:
// Data Filters
apply_filters('woocommerce_print_products_title', $this->post->post_title);
apply_filters('...
0
votes
1
answer
11
views
Neither intermediate_image_sizes_advanced or intermediate_image_sizes filter is firing
I got the example straight out of the docs. brand new wp install, no plugins, no nuthin.
It doesnt dump and it doesnt die().
functions.php:
function wpdocs_disable_upload_sizes( $sizes, $image_meta )...
0
votes
0
answers
31
views
Having trouble querying multiple custom taxonomies
Currently trying to find only posts that match multiple custom taxonomies however im getting zero posts every time i try. How can i filter these multiple taxonomies using the and relation if some ...
0
votes
0
answers
18
views
Change filter id into slug
I have a link like this when filter products by taxonomy "brand"
domain.com/shop/printer/?brand_id=10
I'm trying to change the link to
domain.com/shop/printer/product-brand-name/
how can ...
1
vote
1
answer
46
views
Load More : Admin Ajax 400 Bad request, returning 0
I've been struggling to create a Load More button on a WP project. Basically, I use the Admin Ajax at our disposal when using WordPress. I also use the fetch API to communicate with it, via my load-...
0
votes
0
answers
35
views
Changing upload directory temporarily
I have various media file uploads that I need to section off into different subdirectories, for example:
example.com/assets/Uploads
example.com/assets/team
They all go under "/assets" but if ...
1
vote
0
answers
31
views
Woocommerce: hide “Price display suffix” when the VAT is zero
is there a way to hide the “price display suffix” of the products when the VAT is zero?
(I’m currently doing some test on a local test site).
For example, the shop is set in Germany, the products have ...
1
vote
1
answer
45
views
In WordPress, I want to use code to filter out one menu item (page) from displaying when I call wp_nav_menu() function
Scenario
I have three pages namely John James and Jessica.
The Jessica page ID is 666 and I want to filter it out so that it DOES NOT show in the menu.
I need help with a simple code similar to the ...
0
votes
1
answer
21
views
How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?
Question:
I'm trying to dynamically switch the front page of my WordPress site based on certain conditions (e.g., whether a user is logged in or not). I have two specific pages that I want to set as ...
0
votes
0
answers
20
views
Change or replace user_profile_picture_description filter, to stop stripping whitespace
It appears that whoever coded WP's user profile form (or BBPress's, if BBPress is replacing the default one) considered it the most important mission in the history of humanity to prevent anyone from ...
0
votes
1
answer
11
views
Add an attribute on WP images attachment link
I have to add an attribute on WP images to add description on Spotlight lightbox.
I tried the wp_get_attachment_link filter but it doesn't work.
function add_data_description_link($content, $post_id) ...
0
votes
0
answers
20
views
Remove wpseo filter from polylang plugin
in polylang there is an integration file for yoast named wpseo.php that adds some translated urls to yoast sitemap, I don't want these urls since I'm doing a custom work on translations with my own ...
0
votes
0
answers
15
views
Woocommerce price filter widget always shows max price of most expensive product in the whole shop
In my Woocommerce shop I use the price filter widget. In my opinion it should only show the max price of the current products in a category or search result, but it always shows the max price of the ...
0
votes
0
answers
37
views
Show post in elementor based on views and specific category with query id feature in elementor
I have two functions for query filter:
function my_query_filter_most_views( $query ) {
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'meta_key', 'entry_views' );
$...
1
vote
1
answer
75
views
Is there a way to auto-link to products when writing a post?
I have created a post where I list items in my product catalogue and add links to said products.
Currently, I manually add links to the products once I have typed them out.
However, I want to know if ...
1
vote
0
answers
16
views
wp reset password page - head inline script
In the reset password page, i have this core inline script in the head section :
<script type='text/javascript'>
/* <![CDATA[ */
var userSettings = {"url":"\/","uid&...
0
votes
1
answer
15
views
How to use parse_query() to add an additional filter based on content to page search?
I want to add another filter box to my admin "pages" screen, let's call it search2.
I want to be able to filter the results that I searched to be limited to only pages that contains search2 ...
0
votes
0
answers
25
views
WooCommerce Attribute Mapping
How to accomplish searching by Make and Model with data added as attributes? Basically I am facing this, I have a website for motorcycle parts and all the data is added as attributes so I have ...
0
votes
1
answer
38
views
Remove rel="ugc" from links in comments
I am trying to Remove rel="ugc" from links in comments, but nothing is working. I even tried Remove rel="nofollow ugc" from links in comments
I also tried many plugins like: UGC ...
1
vote
0
answers
29
views
add_filter( 'user_has_cap','my_function', 10, 3 ); and call to get_users in my function triggers an infinite loop in user list
I use:
add_filter( 'user_has_cap','my_function', 10, 3 );
In user list to allow users to edit only a specific list of users with a meta user identical to a current user connected.
To get the list of ...
0
votes
1
answer
75
views
'Add Media' to post - filter images
Can anyone help me with this? ...
I am trying to locate and understand the javascript and/or php/ajax code that filters the thumbnails that show in the interface when a user clicks "Add media&...
0
votes
0
answers
50
views
get last part of page url and add it as cat in wp_query
I have a page URL : https://mwallpaper.ir/mobile-wallpapers/birds
and I grabbed last part of URL with this filter :
add_filter( 'example_filter', 'catslug_callback' );
function catslug_callback( $...
0
votes
1
answer
124
views
Custom post type template not loading from plugin
I've created a custom post type called jdshs_jobs in a plugin and I have tried to get Wordpress to associate a template (single-jdshs_jobs.php) from within in sub-folder:
.../plugins/plugin-name/...
0
votes
1
answer
87
views
FacetWP was unable to auto-detect the post listing : Having an issue with ACF load choices causing FacetWP error
I have a project website in which I am using Facewp to list custom posts on which I attached a custom field using ACF. I am using Extended ACF to make frontend forms to create/update those post types. ...
0
votes
0
answers
29
views
How can we extent core/group or cover block?
I am working on a project and it has a requirement of adding separate background image for mobile devices.
So is there any way that I can add InspectorControl on the core/group block for the mobile ...
1
vote
0
answers
37
views
Custom updater to change plugin version
I have a custom plugin hosted on github, and had previously had a plugin updater class that would poll the repo for the 'latest' version.
Now the plugin is on multiple sites, but we want the option to ...
0
votes
0
answers
28
views
Hide attributes based on previous selection
I've been trying to achieve this on my shop page but I am not able to. Basically I have 3 attributes, brand, model, year. I want to hide specific attributes or disable them ( make them not selectable )...
3
votes
1
answer
115
views
"Invalid parameter(s): attributes" issue in context of "blocks.registerBlockType" filter
The goal
I'm working on a plugin that adds classes and attributes to any block.
On the frontend the blocks are animated using JS and CSS.
It basically works, but...
It seemed to be working fine with ...
0
votes
0
answers
21
views
Customize WP Filter Hook
I am using WP Form Locker Add-on Plugin.
When you confirm your email the plugin sends you email with verification link.
The email reaches in English.
I want to make it reach in Arabic
This is the ...
1
vote
2
answers
24
views
How to override hook from themes functions.php which is defined in plugin
I have defined a apply_filters hook inside plugins_loaded hook in my custom plugin.
$post_singular_name = apply_filters( 'post_singular_name', 'Event' );
new Prefix\Post_Types($post_slug, $...
0
votes
0
answers
48
views
Can't change WordPress / WooCommerce attribute value order
I'm making a website/webstore in WordPress/WooCommerce and ran into a problem with product attributes and swatches. We sell engraving materials (layered sheets) with a lot of different colors. So I ...
0
votes
0
answers
21
views
remove_function method removing next priority action too while removing current priority
I found a strange behaviour from the WP core related to remove_action,
add_action('my_custom_hook', 'mycustomfunc2',99);
add_action('my_custom_hook', 'mycustomfunc3',100);
function mycustomfunc1(){
...
1
vote
1
answer
145
views
Attributes array not saving values
I followed along with this stack overflow I got everything working except for the values saving in myTest attribute array. For some reason it's not and I've been stumped for over a week on it. Here is ...
0
votes
2
answers
20
views
Apply function only for specific post
I have a function to change the locale of the posts
function change_og_locale( $locale ) {
return 'es_ES';
}
add_filter( 'wpseo_locale', 'change_og_locale' );
Now, I would like to fire it only if ...
1
vote
2
answers
120
views
How to change content hash value, within the_block_template_skip_link action?
When my WordPress site loads up, towards the top, I have something that is generated in the DOM....
<a class="skip-link screen-reader-text" href="#content">Skip to content<...
1
vote
0
answers
63
views
Possible to overwrite load_template function in plugin using functions.php
So, I am currently using a Wholesale plugin for Woocommerce which, by default, redirects users to it’s own Wholesale Store page. The caveat is that the Wholesale Store page only uses the archive-...
1
vote
0
answers
12
views
Adding custom filter not working
this maybe a stupid question, when I’m trying to create a custom filter to hook into later and filter and return something, I don’t get any results. I am testing this in the themes functions.php
//...
0
votes
1
answer
39
views
How to filter the terms of custom taxonomy by author id in admin panel
I created custom taxonomy named 'Customers'.
In admin panel, different users will login and create their Customers in that taxonomy.
I want to show them their own Customers only. Currently they can ...
1
vote
0
answers
60
views
Core/Image access caption in render_template and in wp.hooks
I am making an override to core/image block -disabling styles, changing markup and such.
I have managed to solve some things, but struggle with some others.
Here is my code:
filters.php
<?php
use ...
1
vote
1
answer
123
views
Only show read more text when when wp:post-excerpt meets excerptLength
NOTE: The issue I'm encountering is specific to Block Themes; I understand how to filter the text returned from the_excerpt in a Classic Theme.
What I would like to only show read more text when when ...
0
votes
1
answer
80
views
Are blocks that are converted to patterns no longer filterable through the_content?
I have a block, say, elseloop/this-block, that was turned into a pattern on one page that it was included on. It is always displayed in an odd spot in the layout, so I want to pull it out of the ...
1
vote
1
answer
29
views
WP "optimizing" PNGs into thumbnails 5X larger than originals - FIX
As I am about to add over 50,000 product photos to a site in development, I am more than concerned about the thumbnails being generated and “optimized” by WordPress. Between WordPress, Woocommerce, ...
0
votes
1
answer
29
views
How to use add_filter to add the extra data to existing array?
Hi I am new to hooks and have a query to add additional data to the existing array. Please check the below code.
I have some basic details and want to add the Phone number using add_filter(). If I ...
0
votes
1
answer
29
views
Overriding an existing filter
There is this function that is part of the plugin EasyDigitalDownlaods' plugin:
public function category_dropdown( $name = 'edd_categories', $selected = 0 ) {
$categories = get_terms( '...
0
votes
0
answers
39
views
filter the custom post type using wp ajax request
I want to filter the custom post type (events) using wp ajax request on behalf of the keyword supplied to it.
Explanation:
I have a from which has 4 fields displaying search keyword, event category (...
0
votes
2
answers
134
views
Show only taxonomy types terms associated with a custom post type in WordPress PHP
I am trying to display only the taxonomy types terms selected on a custom post type "newsroom". The code below shows all taxonomy types terms for every type of post. Is there a way to show ...