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
9 views

Remove “Private” + “:” in title does not work

I would like to remove the "private" prefix for each post title. I found the filter here. I managed to removed the word "Private" but when I concatenate with " : ". That does not work anymore. I ...
0
votes
2answers
18 views

Display all product tags associated with a specific product category

I need some help writing a shortcode to display all product tags associated with a specific product category which can be displayed on any page. My problem is that I can display all product tags ...
0
votes
0answers
7 views

Automatically update woocommerce products after 10 minutes when they are published from frontend

Is there a function than can update a woocommerce product in 10 minutes after it's published from frontend? I'm asking because i'm running Rh frontend publish pro for users to submit products to ...
0
votes
0answers
10 views

How to gray out options in dropdown when certain variation is choosen instead of dissappearing [on hold]

I am looking for a way to gray out the options in the dropdown of a woocommerce product page. Currently i have 520 variations for a product. Example below. Here is the link to the product page: ...
0
votes
2answers
17 views

Child theme remove parent filter in functions

Have a parent/child theme setup. The parent theme has a filter I want to remove. How do I remove these filters in the child theme functions? /** --------- */ /** COMMENTS */ /** --------- */ /** ...
2
votes
1answer
20 views

multiple functions with same filter

I want to use the same filter hook in different locations, and I just want to make sure this is OK to do so ( preliminary test shows it works, but I am not 100% sure it is OK to do so). So the ...
0
votes
0answers
15 views

Alphabetize my dynamic submenu of subcategories

I used this method to dynamically create a submenu of subcategories, and it works perfectly: Dynamically add sub-categories to any category in the menu But I want the subcategory dropdown menu items ...
0
votes
0answers
9 views

How to add link video on thumbnails post in divi theme [on hold]

I already tried using the post_thumbnail_html hook filter but it seems that no html changes have any effect This is the code I tried to use: function video_on_thumbnail( $html, $post_id, $size){ ...
0
votes
1answer
31 views

why require - does not load filter

I am using the boilerplate for WordPress plugin : https://wppb.me/ but I don't know if it's because of there coding this is happening. What I am trying to do is use require and load the below code ...
0
votes
0answers
15 views

wp_lostpassword_url does not execute

since a few days i try to find a solution how to check the $_POST['user_login'] variable before(!) wp_lostpassword_url will be executed. That's why, because i want to keep wrong typed in usernames ...
1
vote
1answer
15 views

Can't get woocommerce_get_price_html to work [closed]

I'm building a function to interact with the price html block in wordpress. This is my code add_filter( 'woocommerce_get_price_html', array( $this, 'get_price_html' )); public function ...
0
votes
0answers
15 views

Exclude categories in isotope.js filter [on hold]

I hope somebody can help me. I have an custom post type (employees) with categories ( office vienna, office berlin, ...). They are displayed at the archive-employees.php template. I display the ...
-1
votes
0answers
47 views

Modifying with a function with filter

I am confused about using the add_filter() for this function function wc_locate_template( $template_name, $template_path = '', $default_path = '' ) { if ( ! $template_path ) { $...
0
votes
1answer
19 views

How can I add image sizes for a specific custom post type?

What I'm trying to achieve is to define a specific image size (a portrait thumbnail) for a specific post type (books), so that only this post type has this thumbnail size generated and I'm not wasting ...
0
votes
1answer
28 views

How to have different site identity logos on each page on Astra Theme [closed]

Original title - Noob here. Wondering how to make use of this Astra theme function / filter to have different site identity logos on each page The function is at line 1471 here (...
0
votes
0answers
23 views

How to wrap pattern-matches from the_content in [wiki]-shortcode tags

I'm working on a function to wrap word-matches* in [wiki]-shortcode tags. I suspect the best method is to use add_filter() on the_content, and parse using RegEx in preg_replace_callback_array(), but ...
0
votes
1answer
28 views

Why does wp_die() not work when inside a namespace?

Consider the following code copied from ACF docs, refactored to work inside a namespace: add_filter('acf/location/rule_match/user', __NAMESPACE__ . '\acf_location_rule_match_user', 10, 4); function ...
0
votes
0answers
21 views

How to find out the page name or slug inside a filter?

How do I find the page name or page slug inside a filter in a plugin? I am customizing a plug-in and I need to run some code based on which page is currently being displayed. The code is inside a ...
0
votes
1answer
21 views

Modify function output in a plugin

I am trying to update one my plugin functions using add_filter with the ultimate goal of changing the order of elements that are output by the plugin. Here is the plugin function: public function ...
0
votes
0answers
44 views

Pass a value returned by a function inside a plugin - Woocommerce PHP

there are more topic on this argouments but I still have this problem. I'm trying to change the total price of my cart in woocommerce, passing a variable from the outside. My class Class nameclass ...
1
vote
1answer
21 views

I can not include page to wordpress function add_filter, the_content

Wordpress Function add_filter I want to include extra page, on add_filter How can I correct this ? Thanks in Advance ! function page_content($content) { global $post; if ( is_object( $...
0
votes
2answers
27 views

Filter Gutenberg Blocks Content

I have a simple terms page made up of heading and paragraph blocks. I'd like to filter the_content before output in order to get the content of any heading blocks and create a menu with links to named ...
0
votes
1answer
54 views

Gutenberg Block - Post Featured Image Filter Hook

I'm wanting to add some functionality to the featured image block in the Gutenberg editor. I've got pretty close: The problem is, I'm unable to select an image, and posts that already had a featured ...
0
votes
0answers
17 views

Filter custom post by taxonomy term

I try to implement filters for the custom post type. I created the container with buttons which represents all used categories: <?php $terms = get_terms( array( 'taxonomy' => '...
1
vote
0answers
17 views

Set default terms for new posts / CPTs

I want to set default taxonomy hierarchical terms for NEW posts or CPTs. That is, I want the term's checkbox to default to checked - visually - in the post-new.php editor before it's saved or assigned ...
0
votes
0answers
29 views

How to change href of a Widget menu item link?

I assume that using a filter would be the best way to do this, but I am not so familiar with php code so I require someones masterful input please! Here is the widgets menu: This widget comes with ...
0
votes
0answers
18 views

Apply pre_get_posts filter in a certain moment (just for a particular block of posts)

I want to apply a filter to a block of posts, for a custom field that I created, called: 'highlighted_in'. To filter the results I'm using the 'pre_get_posts' hook, and it works. But I think my ...
1
vote
0answers
31 views

Add filter by custom field to block of posts

I need to put a block on a page that displays 'highlighted posts' manually. First of all, I do not know if there is a better way to do this, creating a new block, or using an existing plugin ... (...
0
votes
0answers
14 views

How to add markup to the wp-custom-header div

I have a custom header video on my WordPress site and I have an overlay (an svg I repeat in the background of a div) that I want to live on top of the video. I accomplished this like so <?php ...
-1
votes
1answer
16 views

how to use apply filter for Class?

Please do not remove the question saying that it's woocommerce. In the code below there is $fields = wp_parse_args( $fields, apply_filters( 'woocommerce_credit_card_form_fields', $default_fields, $...
0
votes
1answer
25 views

Handle multiple parameters in filter

I am trying to setup a filter which supports more than one parameter: function FILTER_CALLBACK($block_id, array $items) { // How can I pass both parameters to the next hook? return $items; } ...
0
votes
2answers
64 views

Post filtering is returning blank page

I embedded some code to generate post filters referencing an article at https://premium.wpmudev.org/blog/add-post-filters/ as displayed below: <form class='post-filters'> <select name="...
0
votes
0answers
14 views

How to create a custom search form to filter data organized in tabs?

Considering that I have an Excel table that represents my "DB", I need to implement a custom search form that: retrieves data from the table, using some filters, and shows short results; opens a tab ...
0
votes
1answer
24 views

Contact Form 7 Custom Validation Doesn't Get Called [closed]

I'm trying to change the filter for email so that it reads "Email Address is Required". I check to is if it is empty(). My tag in Contact Form 7 is [email* your-email] You can see here, I tried ...
2
votes
1answer
20 views

WordPress tag cloud add more links

Due to location constraints, the Tag Cloud widget settings display 30 tags. Can I insert a custom link at the end of the tag cloud? So that I can link to a tag archive page. Thanks in advance!
0
votes
0answers
15 views

Filter posts by tags, if they have have the same amount of matching tags, filter by date. WHAT?

I know basic WordPress development. I still get confused with what functions can be used outside of the loop and inside, blah blah. But for the most part, I can handle the basic development needs of a ...
2
votes
1answer
113 views

Remove the Parent category from the permalink but leave the child category

I had a site with a url structure like example.com/news/story-1 example.com/news/local/story-2 example.com/food/tacos/story-3 Now it's been moves to a multisite, with /news/ and /food/ as the site ...
0
votes
1answer
24 views

WordPress wp_get_current_user returning blank values until refresh

I'm developing a site in WordPress and creating my own theme. As part of the theme, I have a custom user login. When a user logs in, the form action directs back to itself and in the header of the ...
0
votes
1answer
14 views

term_link filter rewrite link only applying half of condition?

Can anyone clarify why this function is filtering all terms in the highlight taxonomy, but not filtering for the subscribe-win term? Neither $term->term_id or $term->slug are working. I don't ...
0
votes
1answer
25 views

Using post_where filter only on main query NOT sidebard new WP_Query

I have a post where filter set up for a CPT archive page. Which works great but i have other WP_Query objects in the sidebar that dont work because the post_where filter is effecting those Objects ...
0
votes
0answers
21 views

Remove status 'archived' from the default post and page view

I have some page status on my wordpress platform : All, mine, draft,published and ARCHIVED as you can see on the picture below When i go to pages, default view is on ALL pages a got 62 pages on my ...
0
votes
1answer
21 views

Is it possible to bind a function to a filter hook via Ajax?

I'm trying to bind a function to a filter hook via Ajax, like that: function ajax_called_function_contains() { add_filter( 'wp_handle_upload', 'save_landscaped_version_of_img' ); }; The goal ...
0
votes
1answer
29 views

Apply filters with multiple filters

I'm learning hooks and filters recently; I understand the basics and, using a test wordpress installation and an interesting plugin (for volunteer signup sheets), I have gotten several "add filters" ...
0
votes
1answer
21 views

Correct Hook/Filter to amend category choices on post edit page

I want to filter available terms for a user when they create/edit a post, I have assigned a custom field to the user where it returns an array of IDs for the categories they can edit. In an action ...
1
vote
1answer
74 views

Can paginate_links() be customized for a specific category or tag?

I am creating category and tag page templates for my client so they can post news articles to the news category page and specific news pages separated by tag with a pagination nav at the bottom of ...
0
votes
0answers
34 views

Customize Password Protected Page input label only

On the password protected page form, is it possible to customize just the password input label? For example; I dont want the text: Password: I just want to change that text to something else like: ...
0
votes
1answer
33 views

Reload page with a different shortcode when a user selects from a dropdown

I'm using WP Job Manager, and the page which lists all available jobs is delivered using a shortcode which can be customized. so [jobs per_page="10"] is outputed in the frontend as: <div class="...
-1
votes
1answer
20 views

For each loop will not append to the_content hook

I'm using the filter to append items to the content on one page only. It's fully working except for the ordering of the $whole variable. The title is appearing after the content but the for each loop ...
0
votes
2answers
16 views

How can I see exactly what arguments are being passed through a filter so that I may modify them?

I'm having a great deal of trouble phrasing this. If I were to use the filter views_edit-page How can I see what exactly is being passed through the filter so that I may edit them? Normally I ...
0
votes
1answer
14 views

Customize plugin's output: filters or setters: looking for an advice

// This class has 3 properties defining 3 differend markup elements. // I need to be able to change the output of $x, $y and $z easilly. class XYZ { protected static $x = '<div class="...