All Questions
35,331
questions with no upvoted or accepted answers
5
votes
2
answers
2k
views
How to refresh Theme Customizer after change color inside wpColorPicker?
I develop my custom widget with setting where I can set up custom color for the widget. I use this code to initialize wpColorPicker instead of default text input in form() method of Widget class:
...
5
votes
0
answers
575
views
Prevent 404 when using pre_get_posts to filter an archive page
I have added a custom taxonomy named "area" to the default "post" post type. It's meant to organize posts by geographical area.
In category pages I've added a dropdown that allows the user to filter ...
5
votes
2
answers
2k
views
Accessing $post global on a custom post type archive page
I have a custom post type called projects, and its archive is at /projects, on the archive page I get notices Notice: Trying to get property of non-object every time I try to access the $post i.e. $...
5
votes
0
answers
231
views
Customize WordPress Media Manager - Media Window
Im trying to customize the wordpress media manager "add media" window to get it as simple as possible to use. So i want to disable/ hide the following fields/ functions because i dont need some or ...
5
votes
1
answer
375
views
How could I add button next to "edit image" button in "Attachment Details"
How could I add button next to "edit image" button in "Attachment Details"
This is the location I would like to add button, Do you have any recommend?
5
votes
3
answers
1k
views
Making plugin unique to not conflict with plugins with the same name
I have plugin that has the same name as other plugin uploaded to wordpress.org
How can i make it unique so it doesn't share "View Detais" link and auto-update with other plugin uploaded to wordpress....
5
votes
1
answer
2k
views
How to add image uploader to a custom widget?
I'v built a custom widget that will show some sport scores. Scores are added trough custom post. When i open new custom post(scores) i enter their team names, score, scores. Now i want to add an ...
5
votes
1
answer
589
views
Cropping, Re-sizing and Saving images from one folder to another folder in wordpress
I'm adding an upgrade for the WordPress plugin which I have developed ages ago. This plugin is just a product catalog, so just show products and their images. Products can have more than one images.
...
5
votes
0
answers
415
views
RequireJS in custom theme. Working Example
I try to add to my custom wordpress Theme requirejs because I do not want to use wp_enqueue over and over to inject used plugins and on the other side I do not want to mess the DOM from the beginning.
...
5
votes
0
answers
2k
views
Fetching private posts or custom post types via WP-API with basic authentication
I've installed WP-API along with Basic Auth. I'm able to fetch cpt posts using
curl http://siteurl.com/posts?type={post-type}
However, if I change a post to private, it is no longer returned. This ...
5
votes
1
answer
2k
views
Sorting posts by custom date fields (non standard date format)
I've inherited a website with a post type courses that has a custom field 'date-start', a Date Picker.
Unfortunately the date start is stored as 'ddmmyy' and the ACF documentation implies that this ...
5
votes
4
answers
2k
views
add_submenu_page() link missing 'admin.php?' prefix
I have two plugins - one is the "primary" plugin called "SmartPost" and I'm trying to extend it with another plugin called "SmartPost E-mails". So, in other words, "SmartPost E-mails" extends and ...
5
votes
1
answer
525
views
Git Workflow for Large, Live Site?
The Wordpress site I am working on has thousands of posts, is updated hourly, and has dozens of plugins and hacks to get it to work in the way it does.
Can someone explain a git workflow that would ...
5
votes
1
answer
11k
views
wp_query->max_num_pages always returns 0 on custom post type
Hi there I am developing a theme where I have to load some posts with ajax, in my index page everything works properly, the problem is when I need to use it on custom post type, I pass the values for ...
5
votes
2
answers
3k
views
custom theme: english .mo file not working
I'm having an issue with a .mo file.
I have a fully functioning localized custom theme that's running in four languages for the moment: Dutch, English, French and Spanish. There is one problem: the ...
5
votes
1
answer
428
views
wordpress query - orderby child post date
I have support ticket system which i have built using wordpress.
The basic functionality is that when a "ticket" is created, it creates a post. When an admin replies, it then add a child post to the ...
5
votes
1
answer
308
views
How can I append custom data to images in the editor?
I've added a custom meta field to my image details so that a client can add a number to their photos (a design choice). The data would need to show up under each image (like a caption) inserted into ...
5
votes
2
answers
1k
views
Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
For a long time I served my blog from http://www.murrayc.com/blog/, with the wordpress installation in /home/murrayc/murrayc.com/blog/. Now I've moved it to http://www.murrayc.com/, without moving the ...
5
votes
1
answer
766
views
Multisite/network--automatic self-registration, blog setup
I am creating a WordPress Network multisite blog in a university environment. It's set up in subdirectory mode, so that each new blog appears as a subdirectory off a common domain name.
The Network ...
5
votes
1
answer
4k
views
I want to load post content by categories using Ajax
I have question.
I would like to load post content, custom post, depends on category.
So first of all I would like to have drop down menu which will list all my categories then once user will select ...
5
votes
2
answers
7k
views
trigger save_post event programmatically
Is there a way to trigger the post saving or updating event in code? such as do_action('save_post', $post_id);
The function here seems to imply that a WP_POST object needs to be passed in. Is there a ...
5
votes
1
answer
143
views
Can I create customizer setting that can handle plugin shortcode?
Can I create a customizer setting which will handle a shortcode from a plugin? Do I violate and rules or guidelines in WordPress theme development?
If it's possible what is the best way to sanitize ...
5
votes
1
answer
633
views
Let readers suggest edits from the frontend
I'd like to make my articles editable at the front-end for any reader who visits the site. (More like a wiki). I don't really want to trouble them through the registration process. I have no idea how ...
5
votes
2
answers
6k
views
Display all posts from all categories with pagination
Alright, this might be a tricky one to explain but I'll do my best.
At the front page I want to display all the posts from all the categories. However I want them to be divided. Take this for an ...
5
votes
1
answer
1k
views
WP-REST API not returning all its endpoints, 404 on documented endpoints
Here's my configuration:
WordPress multisite installation on a subdirectory
WordPress version is 4.7
Let's say my WordPress site is example.com/mywebsite
My WordPress site has published posts
The ...
5
votes
1
answer
816
views
Can I get at WordPress code from inside a Selenium test?
I'm writing unit tests using PHPUnit and WP_UnitTestCase, and using Selenium for front-end testing.
My Selenium test classes merrily click around my pages without trouble. What would be truly useful, ...
4
votes
0
answers
138
views
Core Block Columns Attributes for Innerblocks Template
I am having trouble setting the blockGap or blockSpacing property for my core/columns block which I am using for an Innerblock template.
This is my JSON below. Everything is working as expected, ...
4
votes
1
answer
207
views
How to save block attributes when the output doesn't change
I have a block with some settings that affect the editor only. So not the output. The issue is that when I change these settings, the output doesn't change. Then Wordpress does not detect the change, ...
4
votes
1
answer
372
views
Problems with Layout inherit in theme.json
I have in the theme.json of my FSE theme the following lines in the code:
"version": 2,
"settings": {
"layout": {
"contentSize": "840px&...
4
votes
0
answers
996
views
Once Again: How to Remove Option from Gutenberg Editor for Specific Block in theme.json
Since WP 5.8 we can define various settings in the theme.json which is much appreciated and really helpful. But there are still some options I cannot find, e.g. how can I remove the layout panel from ...
4
votes
0
answers
194
views
How to remove 'noindex, follow, max-image-preview:large' in search page Wordpress 5.7 up
Is there any way to remove 'noindex, follow, max-image-preview:large' in search page in Wordpress 5.7 and up? As I want to make the search page indexed in search engine, but Wordpress 5.7 and up ...
4
votes
0
answers
106
views
Does WordPress only support HTTP 1.1?
I'm not sure if this is a bug or if I'm missing anything. But according to the documentation for WP_Http::request(), you should be able to set the HTTP protocol version with the httpversion option.
...
4
votes
0
answers
131
views
Is it safe to delete from db orphaned posts i.e. whose post_parent no longer exists?
I inherited a couple of WP + WooCommerce shops with roughly 30,000 products for sale each, and a wp_postmeta which is over a million lines. The former webmasters ran away.
In an effort to clean up old ...
4
votes
0
answers
308
views
Docker compose with wordpress:cli-php7.4 stalls on 'The site you have requested is not installed'?
I have the following docker-compose.yml file where i'm using the wordpress:cli-php7.4 to get the core wordpress and wp-cli image.
version: '3'
services:
wordpress:
depends_on:
- db
...
4
votes
1
answer
396
views
How can I list only sites that use a particular theme or plugin?
I need to search through dozens of WordPress multisite (network enabled) installs for sites that use a particular plugin.
How can I list only sites that use a particular theme or plugin, preferably ...
4
votes
0
answers
564
views
Is there a core Sortable component in Gutenberg?
I managed to somewhat replicate the product gallery metabox from WooCommerce in Gutenberg using the
third-party react-sortable-hoc component. As it seems that this component is no longer supported, I'...
4
votes
0
answers
70
views
Using Primary Color in Plugin Block
I'm developing a Gutenberg block, and I want the block to fit in as nicely as possible with the users site. So I'm trying to include as little styling of my own as possible, eg. allowing buttons to ...
4
votes
1
answer
2k
views
Add PHP block template to content using wp_insert_post
I have created a block template so that every new post starts with a certain collection of blocks.
In the below reduced example, let's say that the block template contains just a heading block and a ...
4
votes
0
answers
857
views
Remove left alignment option in core/image block
I’m trying this code to disable the left alignment option from the core/image block. I just want to make available the center and right alignment options.
wp.hooks.addFilter(
'blocks....
4
votes
0
answers
5k
views
How to fix samesite attribute in wordpress for chrome errors?
I have several wordpress sites that run on a rhel7 box that I admin. All of the sites use a custom SSO plugin that I wrote.
Today I was told that other sites were having issues accessing one of ...
4
votes
0
answers
644
views
The Block Editor: Disable "Color settings" in the specific block
The "Pull Quote" block comes with the "Color settings" option which is located in the sidebar.
I am aware that we can remove the style using wp.blocks.unregisterBlockStyle but is there a way to ...
4
votes
0
answers
932
views
How to use getBlockIndex
I want to create a block with HowTo microdata markup and automatically assign ID to child blocks. I have created a holder as the parent block, and I want to give the first child block id="step1", ...
4
votes
0
answers
200
views
Lock post meta block at the bottom of a custom post type
I'm using the template feature of Gutenberg to add a post meta block (with a couple of input fields) at the bottom of a custom post type:
$args = array(
'show_ui' => true,
'show_in_rest' =&...
4
votes
0
answers
213
views
Gutenberg Blocks - Attributes from comment delimiter or from HTML?
I wrote a custom block and am trying to better understand the interplay of the JavaScript and PHP on both front and back end regarding blocks.
Say I have some block that I want rendered dynamically. ...
4
votes
1
answer
430
views
Why does is_user_logged_in() return false after redirect from another site?
I am developing a WordPress site that redirects to an external payment gateway after a user registers for the site. After the user makes a payment the user is redirected to a page to complete their ...
4
votes
0
answers
84
views
Gutenberg reusable blocks - is it possible to customise an instance?
Is it possible to have custom settings for a particular instance of a reusable block? If you change any settings/data for a reusable block it changes for all instances where that block is used. This ...
4
votes
0
answers
382
views
Is it possible to bulk migrate all deprecated instances of a gutenberg block?
I wrote a plugin which defines a gutenberg block. After using this block in posts, I've changed its definition inside my plugin, so now I have a "deprecated" entry in the block configuration ...
4
votes
0
answers
3k
views
x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response
I would like my dev server on http://localhost:8080 to work with my wordpress install's rest api, of which the api base url is at http://localhost/wptest2/index.php/wp-json/ I am currently getting the ...
4
votes
1
answer
164
views
Migrate Changes from a Staging Site to Production
Is there a tool that allows me to "record" changes to a staging site and later replay them on production?
It is a common usecase for me to set up a staging site (Duplicator is great for that) and ...
4
votes
0
answers
176
views
Hooking a callback into the code within a Gutenberg block
I want to run some JavaScript when a user uploads an image or images using the core/image block or core/gallery block. Ideally I would run my own code when the onSelectImage function is called (and ...