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

How do I check if I can use the allowed_block_types filter?

For a WordPress theme I deregister a few blocks for Gutenberg (in fact, I only register the ones I need). For this, I use a filter: add_filter( 'allowed_block_types', 'amb_allowed_block_types' ); ...
0
votes
0answers
21 views

Have get_the_post_thumbnail output different image if custom meta exists

I have a meta box on each post where a user is able to select another image from the media library. I want this image to override the output whenever get_the_post_thumbnail is used across the whole ...
-1
votes
0answers
7 views

Multi-Step search WITHOUT WooCommerce

I asked this before but didn't get a good answer so I'm asking again. I need a Multi-Step filter and I DON'T want to filter Products (99% of these plugins are for WooCommerce -.-). I want to filter ...
0
votes
0answers
9 views

Filter posts by tags in a category

I need a little help. I made a page where I listed posts in a certain category. I'd like to filter this posts by tags. My question is how to get tags for each posts and how to write a code for the ...
0
votes
1answer
15 views

Edit Post Permalink option removed, looking for possible causes

The edit post permalink button is totally removed ( not hidden with css ) from the edit view - but the slug is still editable from both the Quick Edit view and also via the "slug" panel ...
0
votes
0answers
12 views

Search Results Counts by Post Category on my Elementor Archive Page

I want this type of search Results Couns functionality. First, visit this https://techpoint.org/tech-directory/ and http://prntscr.com/trbmox, then you got an idea of what I want. My website link is ...
0
votes
1answer
13 views

How to get the full product name by ignoring custom modification on it

I've added a filter to simplify product name on my shop page. This is the code I use add_filter('the_title', 'mod_product__title', 10, 2); function mod_product__title($title, $id) { global $...
0
votes
0answers
12 views

Override template with child theme on specific conditions only

I have a template override of the woocommerce checkout page in my child theme. However, I only want to override on specific conditions. Is there an easy way to do that? Let's say I only want to ...
0
votes
0answers
18 views

Add a new page for every value added in my db table

i'm working on plugin and i need create a page every time a new values is insert in my table. That s my function for create a page with value name. In $name there are all the values from my db and in ...
0
votes
1answer
26 views

Modify WordPress Page Title (<head></head>)

I'm trying to modify the WordPress page title. However I'm fairly new to WordPress functions, hooks (filters & actions) and so on. What I could achieve is to change and modify WordPress titles in ...
1
vote
1answer
46 views

What different ways can a plugin add a filter to a Wordpress site?

I have a filter that's being applied, but I can't find a corresponding call to add_filter(). Is there any other way it could be added? Specifically: I'm trying to maintain/make some changes to a ...
0
votes
0answers
10 views

Load ACF values from a temporary wordpress table programmatically

I want to show ACF values from a temporary table in WP database. Which ACF filters I need to use to achieve this? I want to display the values in backend and frontend just like ACF. Any help will be ...
1
vote
0answers
14 views

Inline Styles on all native blocks

Is it possible to apply inline styles to all blocks via filters? Or do only some blocks support it? basically I want to add the ability of adding a background image to a single column. So I added an ...
0
votes
1answer
22 views

Modify existing plugin function with add_filter

I am relatively new to Wordpress and using custom filters and hooks. My site uses the TablePress plugin. But I need to be able to add the html attribute of role=presentation To all tables created ...
1
vote
0answers
10 views

Replace youtube embed in wordpress

I am using this code to replace youtube video: add_filter('embed_oembed_html', 'foo_embed_oembed_html', 99, 4); add_filter('video_embed_html', 'foo_embed_oembed_html'); function foo_embed_oembed_html(...
0
votes
1answer
11 views

Filter wp_redirect() to stop redirect under certain condition

I am developing a tool to print PHP debug messages on screen. I would like to stop the wp_redirect() function from actually doing the redirect if the debug tool contains a message that it wants to ...
0
votes
1answer
13 views

Access ACF fields within custom preview function?

I'd like to access custom ACF field values from custom_preview() filter? add_filter( 'preview_post_link', 'custom_preview' ); function custom_preview() { // how to access ACF field values here ? }...
0
votes
0answers
7 views

Filters post by subcategory slug using buttons

I load in subpage post with one category now i try filter this post by him subcategory and get link to page some like mypage.com/subpage/?slug=fish after click button and see only fish post. I should ...
0
votes
0answers
16 views

custom error message for empty username and password using authenticate filter not working

I'm trying to override the authenticate to edit the default error message. /** Purposed: Custom Login Error Message Description: This function override the default error message on login form. **/ ...
0
votes
1answer
16 views

How to append to an array and return the results in a filter?

i am trying to get array in filters in wordpress i dont khnow how to do it. add_filter('ft_tabs', function ($tabs) { return array_push($tabs, array( '111' => 'aaa', '222' => '...
1
vote
1answer
54 views

Randomize attachment IDs

I'd like to have my attachments IDs being random (not sequential). Just like what this plugin does, but for attachments. I've tried to look into the source code of the plugin, but it uses filters that ...
1
vote
1answer
17 views

How to add 'total' value to custom column title on the posts list page

I have added custom column to all posts page by this code: // ADD NEW COLUMN function len_columns_head($defaults) { $defaults['post_len'] = 'Symbols'; return $defaults; } // SHOW POST LENGTH ...
0
votes
0answers
7 views

How to sort products in shop page by defined category order?

I am currently working on sorting the shop page products based on a defined category order and stock count. I got the stock count sorting working but I am unable to find a proper way to implement sort ...
0
votes
1answer
20 views

How would I go about replacing this function in my child theme located in inc/template-tags.php

How would I replace this function that lies inside inc/template-tags.php in my parent theme function theme_navigation() { ?> <div id="theme-nav-container"> ...
1
vote
0answers
19 views

How to link the whole list item in Gutenberg's latest posts block?

I am using a Gutenberg's 'Latest Posts' block on my front page. Featured image display and grid layout are enabled in the block settings. By default, only the post title is linked to the actual post. ...
0
votes
0answers
14 views

Removing comment lines from all enqueued js files using a filter function

Is there a way to filter all enqueued javascript files and remove all comment lines without using a plugin ?
0
votes
1answer
23 views

Display/Filter post using if else statement

Here it is: I want to filter my post based on category (Party) If the post with category Party has tag which is 'event', it is the one that will display If there is no ''event' tag, only the recent ...
0
votes
1answer
31 views

How to stop Wordpress from completely overriding my <img> tags in my templates?

I'm busy with a Wordpress theme and in some templates I use images (like home.php). I do the calculations for the srcset and sizes for every template/image individually and store the urls and values ...
0
votes
1answer
21 views

Adding an item to an anonymous array inside a filter?

I'm trying to add a user_role inside the ATUM stock management plugin. Currently it's only visible to admins, while I also want to add shop_managers. But I just can't succeed in adding it successfully ...
0
votes
0answers
16 views

Add an attribute to the root from functions.php with add_filter

I followed this link. First thing I did was to add my dark-mode switcher, add JS to handle it and edit my CSS accordingly. Thing is, I didn't exactly do that, I used the possibility to have a global ...
0
votes
0answers
11 views

Set a numeric range for post ID generation based on post type?

I'm wondering if there's any way to configure WordPress to assign post IDs like so: Pages ID range: 10000 to 19999 Posts ID range: 20000 to 29999 Custom post type 'A' ID range: 30000 - 39999 Custom ...
1
vote
1answer
41 views

How to get an array of years from all of the search results, and use it to filter by year the paginated loop?

I hope this is not too dumb: even though I'm learning at an acceptable rate, my WP knowledge still has some important gaps. What do I have: My search.php template gets its results from the normal ...
1
vote
1answer
27 views

Modify a Filters Second Parameter

I have this filter: $post_arr = apply_filters('insert_product_post_data', $post_arr, $data); add_filter('insert_product_post_data', 'my_filter', 10, 2); function my_filter($post_arr, $data) { //...
0
votes
1answer
18 views

Would like to use hook or filters to customize email templates

I hired a contractor to help me with my site a few years ago when I didn't have the coding experience that I do today. The contractor ended up making new templates for almost every email, and they are ...
0
votes
1answer
21 views

Ajax filter - show all results that contain at least one filter

For a project I use Timber (TWIG) with WordPress. I'm trying to implement ajax filter with tags on a video template. But it doesn't work like I would like. For the moment my system is too strict. ...
0
votes
0answers
16 views

How to filter menu of categories on attribute archive pages

The following PHP displays menu of WooCommerce product categories: <?php $orderby = 'name'; $order = 'asc'; $hide_empty = true ; $cat_args = array( 'orderby' => $orderby, 'order' ...
0
votes
0answers
13 views

Moving beadcrumbs to different part of the page with hook and action

I am using the Avada theme, and WooCommerce. This is mostly a question about hook / filter syntax and usage. I need to move the breadcrumbs from the normal place, inside the page title bar, another ...
0
votes
0answers
16 views

Use apply_filters to fetch value in another function

Is it possible to fetch apply_filters value some other place like a global variable? function one(){ $value = 'default'; .... some functionality to set $value return apply_filters( '...
0
votes
2answers
41 views

Removing menus from users other than the administrator

I want to remove some of the menu links from all users except the administrator. How can I do it?
0
votes
0answers
10 views

How do I create a button, that when clicked, will navigate to my woocommerce store page and automatically apply specific attribute search filters?

How do I create a button, that when clicked, will navigate to my woocommerce store page and automatically apply specific attribute search filters? The tools at my disposal are Divi for front end, ...
0
votes
1answer
19 views

How to edit post meta data before publishing the post it self wordpress?

I've a custom field in a custom post type whose value I want to calculate dynamically before publishing the post itself for the first time and this custom field gets stored in the postmeta table. How ...
1
vote
2answers
36 views

Show only geolocated user country into Woocommerce checkout country fields

What I'm NOT trying to do: Remove or hide checkout (billing/shipping) country fields What I'm trying do to: Show only ONE country in checkout (billing/shipping) country fields, depending on ...
0
votes
1answer
11 views

Add a div of content within the_content after a certain block

In gutenberg I have several blocks: paragraph heading paragraph code paragraph In php I'd like to find the code block and append content after the block. I'd imagine I need to use add_filter and ...
0
votes
1answer
37 views

WP_Query filter by custom meta

I try to make a page to list users with a meta values. I search to get all users with a site url or user_description Thx
0
votes
1answer
37 views

Want to filter only parent post in admin area

I want a filter like this in my custom post "books". This filter should only bring up the parent post.
0
votes
1answer
20 views

Filter in Custom post type to find the parent post

function fws_admin_posts_filter( $query ) { global $pagenow; if ( is_admin() && $pagenow == 'edit.php' && !empty($_GET['my_parent_pages'])) { $query->query_vars['post_parent'] = ...
0
votes
1answer
13 views

Get current user data

I do work on filter posts by current user, but in my dropdown list, i can get only all users list, but I need to see only the current user function getСurrentUserForFilter(){ $res = ''; $...
0
votes
1answer
20 views

Multiple Tag Filtering

I am writing a theme for Wordpress and I need a tag filter tool for posts, that can filter by multiple tags simultaneously, without a submit button, no checkboxes, no radio’s, and a show all posts ...
0
votes
1answer
64 views

Hook for changing excerpt content when excerpt not set

Title says pretty much all of it. I need a filter that I can use to change excerpt content for those posts that have no excerpt set. Now, I've tried both the_excerpt and get_the_excerpt, they both ...
0
votes
0answers
20 views

How can I override add_filter function which uses $this?

My goal is to change the registration email sent to new users. However, overriding the function responsible for sending the email does not work.. The relevant file in the parent theme folder looks ...

1
2 3 4 5
54