All Questions
112,157
questions
0
votes
0
answers
3
views
Getting category posts from a certain year
Is there a way to get category posts from a certain year?
I know how to get all posts posted in a certain year -> www.example.com/**year**/
or with months -> wwx.example.com/year/month (that's ...
0
votes
0
answers
6
views
How to make a post accessible from multiple post type slugs?
I have two custom post types
colors
shapes
I have a post called "red" under the custom post type "colors". The default URL for this post would be
example.com/colors/red
Now I ...
1
vote
0
answers
15
views
Gutenberg add extra attributes to custom format
I'm creating a custom format (adding a custom option to the format toolbar) using the following guide: https://developer.wordpress.org/block-editor/how-to-guides/format-api/
import { ...
0
votes
0
answers
5
views
How to disable Page Preview on sidebar in Page Editor in backend of wordpress?
I'm trying to update this contact page and it's not letting me click "update" because it's forcing me to fill out the form. When I do a test in the required fields, it's giving me an error. ...
0
votes
1
answer
15
views
Show Featured Image Dimensions and size frontend with shortcode
I was wondering if I can show my featured image Dimensions (W x H in px) and the filesize in mb. In my Wordpress post with a shortcode.
thank you in advance :)
0
votes
0
answers
12
views
Related posts by child category otherwise parent category
I'm trying to use this code to display related posts by the same category as the current post but if the post is in a child category, i need to show related posts by that child category, not the ...
0
votes
0
answers
13
views
WordPress custom menu can't show 3. level submenu
I Use a custom walker from my menu in WordPress and my menu doesn't show all levels.
https://soulofcroatia.com/ ->One Day menu item.
This is my code in header.php
<?php
...
0
votes
0
answers
11
views
Variations table: tiered price in a separate column
In our store we have a variations table, it's a Product Variations Table Listing plugin for Woocommerce.
Among the items in the columns, there is no option to include the strikethrough price. The ...
0
votes
0
answers
9
views
Wordfence: A potentially unsafe operation has been detected (http response code 403) [closed]
I have implemented a question and answer forum for programming questions using WordPress.
Wordfence plugin is installed on my WordPress system.
Content of posts have programming code with syntax ...
0
votes
0
answers
23
views
Custom Field: how to save array of multiple key-values in WordPress
I have this kind of data on my database:
<wp:postmeta>
<wp:meta_key>
<![CDATA[property_icalendar_import_multi]]>
</wp:meta_key>
<wp:meta_value> &...
0
votes
1
answer
24
views
php redirect with custom user roles set and working but redirect not working for when users are logged in
I have created code to add custom user rules. It works. However when I try to tie in the code for redirecting an already logged in user based on one test role, then it doesn't work. What am I missing ...
0
votes
0
answers
23
views
WP query taxonomy optimization
Is there any way to speed this query? Noob here.
SELECT wp_posts.ID
FROM wp_posts
LEFT JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE 1=1
AND (...
0
votes
0
answers
9
views
Trying to create a Video News Page, that contains only the video and the title of the post that it was first uploaded to
I'm trying to create a new Page that contains only Videos, which are first uploaded inside a post that also contains some text and a title, which title I want to use to represent that particular Video....
0
votes
0
answers
25
views
Creating posts with links from a txt file
I have a script which scrapes articles from the web and saves the url to a .txt file. I've created a custom plugin which on activation, loops through the urls and creates a draft post with the content ...
0
votes
1
answer
11
views
comments_where Hook
Is there a similar replacement of the hook posts_where for comments (WP_Comment_Query)?
I need to modify the where clause for a comments query like it is shown in this tutorial (“4. Sub custom field ...
0
votes
0
answers
12
views
Why am I getting the error: Cannot update a component (`Unknown`) while rendering a different component (`Edit`)?
I recently upgraded to WordPress 5.9, and I'm now getting the following error in a custom block: Cannot update a component (`Unknown`) while rendering a different component (`Edit`). The code is as ...
0
votes
0
answers
8
views
Why is Elementor showing author and previous link when creating a page template? [closed]
please see the image below for reference
0
votes
0
answers
12
views
Retrieve posts that have a given checkbox value selected with ACF [closed]
I have tried everything, but nothing solves my problem.
This is the code I use to retrieve posts that have the selected value in the checkbox:
$args['meta_query'] = array(
'relation' => 'OR',
...
0
votes
1
answer
22
views
How to Add text value in Automatically in this conditions?
**how to input a text value in this conditions automatically , when user input text fields value **
**which condition do I apply ? **
code was added :
0
votes
0
answers
6
views
How to override Bootstrap css with my child theme css in wordpress?
I am trying to load my site's child theme's css after Bootstrap CDN css in wordpress. I tried using these code but it doesn't work. The Bootstrap css is not overriden. What should I do to fix that?
...
0
votes
1
answer
12
views
WordPress Multisite for multi-language
I want to make a WordPress with multiple languages. I have two WordPress sites and I want them to use the same domain name.
Site 1: http://example.com/en
Site 2: http://example.com/de
Is this possible?...
0
votes
1
answer
24
views
Let current user know pending posts counts using wp_query
I'm working on a query to let a logged-in user know if the user has more than 5 pending posts. Here's what I ended up with:
// Start the query
$query = new WP_Query( array(
'post_type' => '...
0
votes
0
answers
32
views
Ajax 400 error when used inside a plugin
I'm really, really stuck.
When I run this code I get a checkbox displayed. When I click the checkbox, the javascript is run. I get "test" in the console, followed by a 400 POST error.
I can ...
0
votes
0
answers
12
views
Woocommerce - Add additional item if some item wants to be added to the cart?
Is there a way for me to force the user to select one from a variety of products into the cart when they try to add a specific item to the cart?
So lets say I have a Product like a blank USB and the ...
0
votes
0
answers
54
views
add_action and do_action: multiple calls to same callback?
I have a setup similar to this:
function get_type_data($val) {
// Get the data from the DB where the ID is $val and return it.
}
add_action('my_hook', array($this, 'get_type_data'), 10, 1);
I ...
0
votes
1
answer
13
views
Anchor Jumps to Another Page [closed]
I've added /#speakers as anchor text to the navigation menu. The anchors are set and it does jump to that section. However, as soon as it does, it goes to another page (for some god knows why reason)
...
0
votes
1
answer
42
views
How do I get the trackback count of a post in wordpress without writing an SQL query?
How do I get the trackback count of a post in wordpress without writing an SQL query?
I tried searching Brave Search and I couldn't find anything helpful. To fetch the amount of comments a post has, ...
0
votes
0
answers
16
views
WordPress is not creating table in database after activating plugin,
I struggled with this a long time! Can anyone help me?
My plugin is not creating a database table once activated. The following code is in the main plugin file.
function woocq_activate() {
global ...
0
votes
0
answers
11
views
No frontpage? But blog page is showing even as Disabled? [closed]
Okay so Im creating a website for the first time and I've encountered some obstacles as I made modifications.
I had just recently finished the design of the front page (home) and have the "Big ...
0
votes
0
answers
40
views
Archive page of taxonomy returns a 404 error
I'm trying to create a template file for a custom taxonomy archive page but I keep getting a 404 error when trying to access that archive page.
Basically something like: domain.com/quizzes/quiz-levels/...
0
votes
0
answers
13
views
Page not visible in 'All pages' after being added through PHP
I'm adding some pages pragmatically as a subpage. This all works well on a test website in 1 locale. However, on the live website we have WPML with 2 locales. When adding them there, these pages DO ...
0
votes
0
answers
15
views
How to add date_query to meta_query array
I am building a meta query array and all fields for the user are optional so some might not have any data. But there is also an option which requires a date query. I am still checking to see if this ...
0
votes
0
answers
7
views
How do I add a tag slug to a category URL to filter posts?
I want to add an option to my site to filter posts by one specific tag on the category page and at the same time have a nice URL (no query strings).
So something like this:
https://example.com/%...
0
votes
0
answers
17
views
shortcode that have access of information outside [closed]
I'm really new to wordpress dev and I try in fact to make a plugin work the way I want.
I use (start using) motopress hotel plugin, and sadly they don't provide a simple way to send specific mail when ...
0
votes
0
answers
13
views
How to remove/hide collapse menu for user/subscriber?
I want to remove/hide the collapse menu item from the dashboard for user/subscriber role only. I don't want to remove it from the admin dashboard.
I am the code below to remove it entirely which was ...
0
votes
1
answer
16
views
Add static text to post URLs
I have 2 pages on my site which include blog posts (real site is pw protected):
https://example.com/blog/
https://example.com/news/
All blog and news articles should have a URL that begins with https:/...
1
vote
2
answers
32
views
Force logout ALL users at a certain time
I'm wondering if it's possible to logout all users 2 times a day using the function wp_logout() ?
I see loads of plugins who can logout idled users but we want to log out every single users twice a ...
0
votes
0
answers
14
views
How do I convert a custom menu wp_get_nav_menu_items into Fourth level?
how can I turn this function from Two-level into the Fourth level in WordPress? This function can only echo the parent and its child, but I'm trying to make it unlimited or at least 4 levels if it is ...
2
votes
0
answers
19
views
Remove a component fill from a Block Editor panel
I'm aware there is quite a lot of flexibility to add to the various editor components in the block editor using SlotFills this is useful when you want to add functionality. However my question is ...
0
votes
0
answers
17
views
Google map API Key restrictions does not recognize website IP
I created a wordpress website and I use google map API. I would like to add restrictions to prevent troubles. So I get the IP of the website from my hosting services and I also ping it to double check....
0
votes
1
answer
25
views
save_post_{CPT} not updating the 'sticky_posts' option
add_action( "save_post_{CPT}", 'update_sticky', 15, 1 );
function update_sticky( $post_id ) {
$stickies = get_option( 'sticky_posts' );
if ( ! in_array( $post_id, $stickies ) ) {
...
0
votes
0
answers
14
views
Is there any way to render the WordPress Gutenberg core/embed block in PHP by passing in the URL?
I'm trying to render the block HTML dynamically by injecting it within a core/query block. The injection is working fine using DOMDocument, but I can't find out how to render the embed HTML. I can use ...
0
votes
1
answer
18
views
Custom taxonomy throw error 404
So in my homework I was given code example and it works for teacher, but not for me. So from what i understand that I'm creating custom post type and custom taxonomy for it, also there is filter that ...
0
votes
1
answer
13
views
custom tables in wordpress Database? (can i just create them with sql?)
i just want to create a custom Table in my WordPress database and i saw many php functions to deal with that my question now is :
can i just create them with an sql command and for what do i need to ...
0
votes
1
answer
11
views
Add leading zero to current post display [closed]
I am using the next to show in a loop of posts the current post and the total of posts published.
$post_query = new WP_Query($args);
$postAmount = wp_count_posts( 'post' )->publish;
<?php echo ...
0
votes
1
answer
30
views
Changing copyright year in Footer.php with Custom plugin
How to add functionality of adding Textbox in own custom plugin simple page in which user add copyright year in textbox for ex.2022/2023 which will change value in my footer.php.
Any help appreciated.
...
-1
votes
0
answers
19
views
Multiple domains using same WordPress, set specific uploads folder
For a project at my office I have 3 websites ending in ".nl", ".de" and ".com".
They all end in the same folder but don't all have the same images and uploads.
My folder ...
1
vote
0
answers
29
views
Speed up / Optimize Admin Edit Post Page on Large Websites (50-150k posts, 50 custom fields per post)
I'm working with a set of large Wordpress installs with 50-150k posts, each with 40-50 custom fields. The installs are very basic, with limited plugins (less than 5), and a default Wordpress theme (i....
0
votes
1
answer
24
views
Order WP_Query by The Order of an Array in Tax_Query
I have a wp_query that uses tax_query to which I pass an array of taxonomy term IDs. I'd like to order my results based on the order of that array but can't get it to work and searching has got me ...
0
votes
0
answers
24
views
Is there way to toggle the publish date display?
I am interested in changing our WP dashboard so that I can choose whether an individual Post will include the publish date or not. Is there a way to do it without a plug-in and insert code that maybe ...