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

learn more… | top users | synonyms (5)

0
votes
1answer
167 views

Creating dynamic filtering on custom post type

My overall goal is to have a custom post type and on the archive page have several different filters in the sidebar, like on a lot of ecom sites. I think this would normally be done in Wordpress ...
0
votes
1answer
34 views

Search and Replace Script Loader in Head Only Works in Footer

I've got a function that uses script_loader_tag filter to search and replace adding asynch="asynch" attribute. It works. I don't want this doing anything in the footer, but rather the header alone. ...
0
votes
0answers
52 views

image_send_to_editor filter

I'm trying to achieve the code below, when using the normal default editor in wordpress. <div class="col-md-6"> <figure> <img class="alignright" src="/wp-content/themes/tna-...
7
votes
3answers
250 views

How to add headers to outgoing email?

I want to add an additional header to outgoing emails on my sites, so I can easily determine which site sent a given email. (I put a standard functionality plugin on all of my sites, so this is easy ...
1
vote
1answer
45 views

Wordpress php filter admin_body_class not working

I have the following function in a plugin I have built: static function filter_add_body_classes( $body_classes ) { $new_classes = array(); // Only when logged in if ( ! ...
0
votes
0answers
37 views

A way to increase image hard crop quality?

WordPress hard crops images when uploaded. I placed this code snippet in functions.php to make sure there is no image compression/quality loss on image upload and it worked great: add_filter( '...
0
votes
1answer
57 views

How to change Woocommerce breadcrumbs content?

I want to customize the breadcrumbs directly from PHP. Some of the pages are generated dynamically and do not exist in the database, therefore i must automatically put them in the breadcrumbs with ...
0
votes
0answers
40 views

Filter a plugin class method

I'm using plugin and am trying to hook into one of it's filters although am having difficulty. The following method: /** /* wp-content/plugins/theme-my-login/includes/class-theme-my-login-template....
0
votes
0answers
31 views

WP_Query order by number of likes

I'm trying to configure WP_Query to order by number of likes. I have a custom table called 'likes', which records which liker (user ID) likes which post: id | liker | post_id 1 | 11 | 120 2 ...
0
votes
0answers
91 views

add attachment-filters on custom modal-media insert

how can I do to have the attachment-filters menu in my upload window? my upload wordpress deafult upload console.log("enqueque on metabox.php - media3.js"); openMedia = { data: false, v: ...
0
votes
1answer
34 views

Post filter Month dropdown at front-end like wordpress backend

when i run the following code. $args = array( 'type' => 'monthly', 'limit' => '', 'format' => 'option', 'before' => '', 'after' =...
0
votes
1answer
22 views

Can I remove or edit an include() from a function with a filter?

I need to edit the output of a plugin and the part I need to change is actually a html file that is brought in using include(name-of-file.html). The function has a filter, but I am just now beginning ...
0
votes
2answers
117 views

Filter posts by author and category simultaneously

I'd like to include in my website a feature for users to only see posts from a certain author and a certain category. I'm able to do it separately but I can't seem to understand how to do it ...
0
votes
1answer
42 views

Password protected Page add_filter to change the text doesn't work

I search a solution to change the text on my protected page: This post is password protected. To view it please enter your password below: I've found this filter hook and I included it into my ...
0
votes
1answer
50 views

Show different pages on site depending on user choice

I am building now a Wordpress site that has a automatic opened popup on the first page which gives the users the possibility to choose between 2 options (ex if they are private customers or company ...
1
vote
1answer
122 views

Adding a Clone link to product attributes - post_row_actions() filter, or how to override a Class question

I have a request to be able to duplicate a product attribute in WooCommerce. Think: duplicating a product (with already existing functionality), or plugins that allow you to duplicate a post. However,...
0
votes
0answers
17 views

woocommerce recent products without certain category

I'm using WooCommerce and MyStile (Theme) Let's consider that I have following categories: Fruits Cars Electronic Software Now on my homepage I want to show the new Products, but only of the ...
0
votes
0answers
26 views

WP_Query pulling all content even with readmore

I'm using a plugin called quicksand that is working for the most part. It hasn't been updated in 2 years though so support there isn't an option. I just noticed though that even though I'm putting a ...
1
vote
2answers
43 views

Passing variable from child theme to parent theme

I want to pass my google map custom colors from my child theme to my parent theme. So in my Parent Theme's functions.php I have add_filter( 'post_thumbnail_html', "map_thumbnail" ); function ...
1
vote
1answer
46 views

how to remove dash (-) post status from post title on posts listing page wordpress

I want to remove post status from post title. E.g Currently on listing page post title comes like "Hello World - Draft" or "ABC - Completed" I don't want - Draft or any other post status. Note* : I ...
0
votes
2answers
48 views

Passing variable from child theme function to parent theme filter

I want to pass a variable from my child theme function to a filter which resides in my parent theme. Please let me know whether below code will work or not ? Is it the right way ? Code in Parent ...
3
votes
1answer
42 views

Some nav-menu filters do nothing

So, I've been trying to write a plugin, and I need to use the 'nav_menu_link_attributes' filter. I tried adding the filter, but it didn't respond - at all. That is, I made it die mid-process once the ...
0
votes
1answer
32 views

Hook in parent theme Menu function

Trying to modify Parent Menus function on child theme, the original function is: function original_theme_menus() { $menus = array( 'top' => __( 'Top Menu', 'theme-domain' ), ...
0
votes
2answers
42 views

Change post title if post has specific category

Basically what I am trying to achieve is to have title changed of posts which are in category number 30. My code is: function adddd($title) { if(has_category('30',$post->ID)){ $title = 'Prefix '....
5
votes
2answers
58 views

What hook do I use to edit the post statuses option in admin?

I want to restrict pending posts to only certain users in the admin section, so I want to remove it from the post status options when viewing all posts (the bit highlighted in red in the image below): ...
1
vote
1answer
178 views

Insert HTML just after <body> tag

I am using the Wordpress theme Twenty Twelve (a child of it to be precise). I want to know how to insert some HTML just after body opening, in just functions.php and not using header.php. Is that ...
0
votes
1answer
12 views

Access or edit custom generated permalinks with WP_Rewrite

I want to create custom permalinks for my plugin using WP_Rewrite. I found the codex the have great examples and this stack topic also explained a lot to me. Currently I've got the following code ...
0
votes
1answer
55 views

How to check if “is single” page

I know – at first glance the problem may seem easy to solve – and I hope it is – I just can't figure out where/ how to check if I'm really on a single page, or just rendering a single page in the loop....
0
votes
1answer
37 views

Regex works in regexr, but not if I filter content [closed]

I want to filter the content of everypost and add classes to my links depending on certain conditions. At the moment I just want to filter all href attributes from the content and change them. ...
0
votes
4answers
130 views

How to prepend to the_title for admin-side plugin's use

When I do this: function append_album_review_to_title( $title ) { global $post; if ( get_post_type( $post->ID ) == 'album_review' && in_the_loop() ){ return 'Album Review: '...
0
votes
1answer
63 views

Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu

The Challenge I have been trying to write a filter that applies (prepends a string) to (a) post titles of a certain post type and (b) to that same post type WordPress admin backend for use by an auto ...
0
votes
1answer
15 views

Filter authors on meta value

I have added a section to my user profiles called ArtistCategory. This can be value X or Z. I'm using the code below to get a list, which I use in a menu and show after the artists display_name the ...
4
votes
3answers
219 views

Remove description from <title> on Home

My theme has support for title-tag add_theme_support('title-tag'), but I can't remove the wordpress description bloginfo('description') from <title> on Home page. I'm trying using this filter ...
0
votes
1answer
26 views

Is it possible to completely replace a post with an action/filter?

Currently I am trying to replace the $post global with another dynamically loaded post in the wp action. However, while even in the templates the correct post data shows when outputting $post, the ...
0
votes
0answers
32 views

How to remove CPT comment feed from head?

In a custom post type I have set has_archive to false. In the head of a CPT page however I still find a link to a feed like this: <link … title="Page Title | Comments Feed" href="domain/cpt/slug/...
0
votes
1answer
73 views

remove_action not working, even after changing priority [duplicate]

So one of the functions in my theme is: public function job_manager_job_filters_distance() { //Show some HTML } And somewhere else in the document lies: add_action( '...
0
votes
1answer
37 views

How can you wrap add_filter with a if is_home() statement?

I have the follow code: if ( !function_exists( 'df_excerpt_more' ) ) { function df_excerpt_more( $more ) { return ' &hellip; <a class="more-link" href="' . esc_url( get_permalink( ...
3
votes
1answer
51 views

wp_get_attachment_url filter won't accept two arguments

Here is the specification for the filter for the wp_get_attachment_url filter: /** * Filter the attachment URL. * * @since 2.1.0 * * @param string $url URL for the given attachment. * @...
-1
votes
1answer
40 views

add_filter adds output in the head

I build plugin and I have a problem I add to plugin: add_filter( 'the_content', myFunction); function myFunction() { $options = get_option('myPlugin_settings'); if (is_page($options['...
1
vote
0answers
160 views

Can't get wp_title filter working in twenty sixteen child theme

I am having difficulty overriding the title set in the admin panel for a custom template page, and outputting a custom <title> tag. The parent theme is WordPress's stock Twentysixteen, which ...
2
votes
1answer
35 views

How can I add information underneath the user's name on the users.php page?

I know how to add columns to the users.php users page with manage_users_columns and manage_users_custom_column, but I don't know to modify the information shown in the default columns (e.g. username, ...
0
votes
1answer
64 views

How to append to title via functions.php for auto-posting plugin [duplicate]

What I've got so far I've finally got the functions.php plugin to append a string to custom post titles of a certain post type with this function: function append_album_review_to_title( $title ) { ...
0
votes
2answers
68 views

Template filter for custom taxonomy terms

I want to replace custom taxonomy term template with my custom template. Like using add_filter('single_template','customFun'); replaces single custom post type template. I have a custom taxonomy e.g ...
0
votes
1answer
43 views

wp_editor customization

I've been stuck in a simple issue for the last couple of hours: I'm developing a website in which I use several wp_editor instances, all with custom buttons and styles. This is very simple to achieve ...
0
votes
0answers
19 views

Ajax filter already filtered custom post list

Clearly relatively new to WP so this might be a dumb question but here it goes. I was able to fetch a custom post list of filtered posts in a specific price range (max.value of $100). Now I want to ...
0
votes
1answer
100 views

How do I remove p tag *insertions*? Disabling `wpautop` removes manual tags

I am trying to post static pages with HTML content. So I need to disable wpautop, but when I do this my content is stripped of all <p> tags it has. I remove the wpautop filter from my header....
0
votes
0answers
29 views

Is there a way to capture http request variables and provide different content?

I want to implement a rest webservice on top of wordpress. That means that for a given content type (custom), if the request either cotains something like ?format=json or the http negociation accepts ...
0
votes
1answer
24 views

Extracting a TLD from the content and assign to custom field

I am trying to get the first instance of a TLD in a post and insert it into a custom field. For example with a post: Hi I am Bob. My website is http://bob.com and you can reach me at bob@bob.com ...
0
votes
1answer
50 views

How to add custom nav_menu_css_class to certain menu only?

I want to add a custom CSS class to menu items. So far, I got it working by using the filter hook nav_menu_css_class. However, I want to add this class to items of a specific menu only. So, how must ...
0
votes
1answer
61 views

Display only text to WordPress loop without loosing the text formatting

I want to display text from content (only text) with the formating (paragraph, bold, italic.) on loop. When I am using this code: <?php echo mb_substr( strip_tags( get_the_excerpt() ),0,255); ?>...