Question: How to filter uppercase and lowercase when the word 'tag' is written in lowercase? and vice versa, how to filter the word 'tag' which is written in capital letters? Here's the code I got from a plugin that hasn't been updated in a few years. function auto_link_tags($content){ //$post_id = get_the_ID(); $post_tags = get_the_tags(); if ($post_tags) { $i = 0; foreach($post_tags as $tag) { $tags[$i] = "~<(?:a\\s.*?</a>|[^>]+>)(*SKIP)(*FAIL)|\\b(?:\\b(" . $tag->name . ")\\b(?=[^>]*(<|$)))\\b~i"; $tag_url = get_tag_link($tag->term_id); $tag_html[$i] = '<a href="' . $tag_url …
I probably have a plugin that makes a request to an URL slowly down my website. At the moment I'm still debugging the issue but, in the meantime, is there a way to prevent Wordpress to request this URL? I know there's the rule define('WP_HTTP_BLOCK_EXTERNAL', true); but it actually blocks every request.
I have created a post filter like the image below, but I have an issue with selecting multiple values from different fields. All the fields in the filter are custom fields. The thing is, in the admin panel, one post has a select field with city Telaviv and with a select field Property Type with a value Garden Apartment. The other post has a different city and Property Type as Ground Apartment. On the front end, if I choose from …
I am talking about the REGISTER form PROBLEM: I have some requests that are coming from somewhere else - not from the user interface. I know this, because these requests don't have all the mandatory fields completed - and this can't be done from the user interface, because of the data validations (for example, you can't submit the form without a name, or without a valid email address) I suppose this is a security vulnerability, and I've heard someone can …
I am trying to create a custom endpoint by custom taxonomies, I have already created another for the categories and it works well, however there is something I cannot solve with this function get_latest_posts_by_term($request) { $args = array( 'term' => $request['term_id'] ); $posts = get_posts($args); if (empty($posts)) { return new WP_Error( 'empty_term', 'There are no posts to display', array('status' => 404) ); } $response = new WP_REST_Response($posts); $response->set_status(200); $data = []; $i = 0; foreach($posts as $post) { $data[$i]['id'] = …
What's the meaning of "Parses the request to find the correct WordPress query" in plain Englush? Reference: https://developer.wordpress.org/reference/classes/wp/parse_request/ I encountered this function while trying to edit a PayPal gateway plugin as below. /** * Parse request to find correct WordPress query. * * @since 1.6.4 * @param WP_Query $wp WordPress Query object. */ public function parse_request( $wp ) { if ( array_key_exists( 'acadp_action', $wp->query_vars ) && 'paypal-ipn' == $wp->query_vars['acadp_action'] && array_key_exists( 'acadp_order', $wp->query_vars ) ) { $this->process_payment_ipn( $wp->query_vars['acadp_order'] ); exit(); …
I'm seeing a weird problem where if someone searches "Test Search" it's returning fine, but if someone searches "Test Search " it's returning some weird posts that don't seem relevant. How do I go about trimming white space from beginning and end of a search term?
I'm trying to make 2 custom post types (authors and works) share the same slug. The authors CPT uses an archive page which functions properly, but works CPT does not need one. CPT 1: https://domain.com/library/authors/author-name/ CPT 2: https://domain.com/library/authors/author-name/works-name/ The permalink rewrite I cobbled together is functional. It pulls the author post ID from a custom meta menu in the works CPT post and then builds the permalink. However, I get a 404 error when visiting a works link because WordPress …
We have a WordPress 5.4 instance that we query through it's API. I am hoping to find a solution for the following problem that works with newer versions as well. What I need is an intersection when fetching posts by category: Each returned post needs to be in category 1 AND in category 2. As far as I know, this is not possible with a vanilla WordPress installation, though that may change in some later version. This problem has been …
I am trying to add onmouseover="this.play()" onmouseout="this.pause()" to the default <video element in Wordpress. I am using Gutenberg block editor. By default, this is what the output from the video block looks like in HTML: <video src="https://example.com/wp-content/uploads/2021/05/sample-video.mp4"></video> I want it to be like this: <video onmouseover="this.play()" onmouseout="this.pause()" src="https://example.com/wp-content/uploads/2021/05/sample-video.mp4"></video> I want to add the onmouseover="this.play()" onmouseout="this.pause()" to the default video element. I have tried the below filter but it's not working: add_filter( 'wp_video_shortcode', function( $output ) { $output = str_replace( '<video', …
How do I hook all http requests in wordpress? More specifically I am interested in examining an http header in the request and then potentially modifying headers in the request so that other plugins that rely on certain headers can work properly. Many answers discuss hooking responses, but I need to hook the request, not the response.
what i want to do it's create filters for my custom taxonomy page. For example. I allready have a custom taxonomy created with thumbnails and pagination ready, but i want to add filter's for the girls. Filter's for select the color of the hair to see the girls for examle : I want to see blonde girls, or for country and etc and also i want filters of most videos, most visited and etc.. Hair and etc example : https://prnt.sc/tjkc3d …
To mesure performance of a wordpress website i need what is the first filter or action executed by wordpress ? it seems that index.php is the input file of server, there is a way to add a global time variable Programmatically by editing this file when a plugin is installed and add this line: $timezone = date_default_timezone_get(); define( 'REQUEST_RECEIVED_TIME', $timezone );
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 database. It can essentially be boiled down to an access plugin based on custom logic. When authorization fails I want to either return statuscode 403 or redirect to a login page. But I am struggling to find the right place to hook in. And …
I am trying to intercept the GET request of a post and add a value to it. function foo($request) { $request['vid'] = wp_generate_uuid4(); return $request; } add_filter( 'request', 'foo' ); and hope that it would be available later with $_REQUEST['vid'] but no access so far any ideas?
I need to intercept the scripts that are added in the footer and head through the wp_footer() and wp_head() functions, something like add_filter('wp_footer', my_function) and then in my_function, I would check the name of the registered script and then perform an action, in that case would read the contents of the script.js file and insert it inline, something like this: Before intercept (this is showing on footer or head): <script type="text/javascript" src="mywp/wp-content/plugins/plugin-name/script.js"> After intercept, I want to show inline script …
I wrote up a plugin that adds a column to the posts, page table (list) in the WordPress Admin panel. Each row has additional input fields (checkboxes) - allow_comments, allow_pings. These checkboxes are used to update comment_status and ping_status with tick on checkbox via AJAX call. Problem begins when I have big load of posts and do a search in the search field, all of my input fields (checkboxes) gets added to the search and if there's a lot then …
I want to send a download link to user by mailchimp, after they filled out a email form. The PHP Request listener is calling my_function(), but inside this function the action is not called. The functions and the action are working. Also after put the do_action(); inside the createDownloadButton() it will be called. Only after write the action inside my_function() it doesn't work?! Inside the functions.php: /** * Place a button * @return string html-form * usage: [download_button download_name='my_download'] */ …
I'm working on a project where I have to filter every Products:product_cat type of taxonomies on ACF. I need those product post type values which contains these taxonomy on the search field. Sadly ACF only supports acf/get_taxonomies_for_select and not like acf/get_post_types. I started with this code, so now I can show all the Taxonomies, but I can't made any filter to it: // vars $simple_value = false; $choices = apply_filters('acf/get_taxonomies_for_select', $choices, $simple_value); // create field do_action('acf/create_field', array( 'type' => 'select', …
I have created two WordPresss custom post types (school, person). Each person is related to a school and the related school's post ID is stored in wp_postmeta under the person's post ID with meta_key = 'person-school-id' and meta_value = the related school's post ID. I have added a person-type (Student, Teacher, etc. ) and the related School's name (by extracting the related school's post_title) to the Person WP edit.php list via WP manage_person_posts_columns and manage_person_posts_custom_column actions. I have added filter …