All Questions

32,377 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
257 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
1answer
428 views

Get frequency of scheduled event

How do I get the frequency of a scheduled event? I am writing a plugin, that would do something in a user defined schedule. The way I am trying to do this, is creating a custom cron schedule, which ...
5
votes
1answer
546 views

Link to Author archive from Navigation Menus in dashboard?

I'd like to display a grid of authors on my site showing the name of the author and their avatar. The tricky part is, I'd like to be able to control this from the Menus page in the dashboard so I have ...
5
votes
1answer
160 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
1answer
643 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
1answer
2k 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
1answer
126 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
1answer
3k views

Change label of title field for posts in the backend

I am trying to add some HTML to the title label in the backend of WordPress. Attempt 1: I am using the following (simplified) function: function change_post_titles() { global $post, $title, $...
5
votes
1answer
782 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
2answers
3k views

Remove email verification when new user register

Please note I'm not posting this question without doing google search, but the problem is every single result I found is either about BuddyPress or WP Multisite, but I have a WP Single installation ...
5
votes
1answer
735 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, ...
5
votes
5answers
810 views

Remove option to allow trackbacks/pingbacks from post page options

I'm trying to disable all functionality related to pingbacks/trackbacks in WordPress and so far I have this: add_action( 'pre_ping', 'disable_pingback' ); function disable_pingback( &$links ) { ...
4
votes
0answers
50 views
+500

Add settings to menu items in the Customizer

WordPress 5.4 added the wp_nav_menu_item_custom_fields_customize_template hook to add custom fields to the Nav Menu Item settings in the customizer. I've figured out how to display the additional ...
4
votes
0answers
31 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
0answers
78 views

Implementing Gutenberg RichText onSplit / onReplace

I need an unordered list, but with options selected for each list item. To achieve this I've created a custom block called icon-list which is a ul element with InnerBlocks, which allows only my custom ...
4
votes
0answers
98 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
1answer
166 views

How to authenticate custom API endpoint in WooCommerce

I have created custom API, which is working fine, but I am not able to authenticate it, it returns result without checking for keys I have created consumer key and secret key from admin. How to ...
4
votes
1answer
132 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
0answers
29 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
1answer
343 views

WP CLI info showing correct PHP binary but wrong version of PHP

When a run a command such as wp plugin update I get the message: "Your server is running PHP version 5.4.13 but WordPress 5.2.2 requires at least 5.6.20" I don't even have PHP 5.4 installed in my ...
4
votes
1answer
136 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
0answers
808 views

How can I extend the Gutenberg table block transform to allow colspans/rowspans on pasted table <td> elements?

I'm trying to allow users to paste (relatively) simple tables into Gutenberg. The editor converts the raw HTML fine but strips out any attributes/classes. For the most part this is good - I want to ...
4
votes
0answers
542 views

WordPress REST API call generates nonce twice on every call

I'm trying to login a user via the REST API, and then retrieve the current user on subsequent requests. As per the documentation, in my plugin, I am creating and retrieving a nonce after a successful ...
4
votes
1answer
509 views

Custom Queries: Joining On Meta Values From Two Custom Post Types

Hi – I'm hoping this is the right place to be asking this question. I am in the process of moving my full football club website onto Wordpress, therefore using a single database for the information ...
4
votes
3answers
2k views

Change permalinks for post type 'post' only

Like many other, I would like to have: domain.com/post-title changed into domain.com/blog/post-title but only for the post type 'post', not for 'page' and especially not for the custom post types (of ...
4
votes
0answers
466 views

What could cause WP-CLI search-replace to not replace all instances of a string?

We're migrating a site from dev to production using wp-cli to replace all occurrences in the database for the url, just like in the search-replace example. (http://example.dev to https://example.com) ...
4
votes
1answer
729 views

Exclude custom taxonomy from search results and archive pages

UPDATE: I have the following code working. It excludes the taxonomy from the search results. However, I would like this only to happen if a user is not logged in. The code below is taking effect for ...
4
votes
1answer
5k views

Add indexing to meta_value in wp_postmeta

Is it poossible to add index to the meta_value column in the wp_postmeta table in order to make faster queries in Wordpress? I have about 5 million rows in the wp_postmeta table and my queries takes ...
4
votes
1answer
202 views

get_theme_mod doesn't return the theme customizer preview's new values in after_setup_theme hook

If I print the value of get_theme_mod( 'enable_sleek_header', false ) it is always the previously saved value. If I print the same thing in the header of the theme, it returns the value from ...
4
votes
1answer
51 views

Importing users from one database to another and saving passwords

I have been trying to formulate a way to take a database SQL file of users from one database and add it to another WordPress database while saving the old WordPress site passwords on the new WordPress ...
4
votes
1answer
1k views

Wordpress on a subdirectory of Laravel - Wordpress pretty permalinks inner page shows laravel

I read lots of discussions about this and found no solution. I have a Laravel web app and added a Wordpress site in a subdirectory. This is what my .htaccess looks like within the public folder: <...
4
votes
1answer
2k views

Creating a post with the REST API, curl and oauth returning 401 error

I'm trying to create a WordPress post using the REST API, OAuth, and cURL. However, I'm running into some trouble. I'm able to create a blank post (no title, slug, etc) using the following code: $...
4
votes
0answers
4k views

WP REST API V2 - Retrieve sub page by full slug (URL/Path)

I'm struggling to see if this is natively supported, or if it's not the best place to implement this functionality - in my app (Laravel) or the same side as the API (WordPress). Retrieving a single ...
4
votes
1answer
559 views

Looking for a way to load a function after customizer preview refresh complete

I need to load a callback function after a wp.customize.previewer.refresh(). I need this because I want to update a template position which is displayed with a custom hook in my theme and scroll the ...
4
votes
0answers
1k views

Setting Cookie Using a Variable from the URL

I need to hand code an affiliate link (we do not want to use an existing plugin). I do not do a lot of coding, so bear with me. It seems so simple I have a link: http://www.domain.com/?code=8765 ...
4
votes
1answer
274 views

Give attachments an archive page

I'm trying to override WP's default URL structure for attachments where, if they're attached to a post, the URL is /post-slug/attachment-slug/ and if not it's simply /attachment-slug/. What I'd like ...
4
votes
1answer
236 views

What permissions should i have set up for the Database User after i have Wordpress set up?

so i was reading this on php.net and read this Never connect to the database as a superuser or as the database owner. Use always customized users with very limited privileges. Before getting my ...
4
votes
1answer
340 views

How to use parent theme's enqueue methods

According to the codex, when creating a child theme, you have to manually enqueue the parent theme's scripts. My parent theme has logic to conditionally display various css files, cached css, and ...
4
votes
1answer
674 views

WP_Site_Query vs. WP_Network_Query in WordPress 4.6

Can someone explain the difference between WP_Site_Query and WP_Network_Query in WordPress 4.6? WP_Network_Query() : Core class used for querying networks. WP_Site_Query() : Core class used for ...
4
votes
0answers
193 views

Retrieve CSS and JS From the REST API

Does anyone know of a way to get a list of all registered styles and js scripts in-use on a site via the REST API? Essentially was wp_print_styles() does?
4
votes
1answer
38 views

Prevent Deletion of Blogs

I'm trying to prevent the deletion of blogs in a WordPress Multisite installation. There is already a plugin that does this, but it uses wp_die() as the solution, which in my scenario does not work. ...
4
votes
0answers
700 views

Order posts by meta_value even if meta_key is not filled

I want to sort search results by the value of custom field ('name-official') for all posts (is this field filled or not). But when I add filter in function.php like function searchExcludePages($query)...
4
votes
1answer
557 views

Using the REST API (v2) javascript client on a private namespaced route

I am using the latest version of the REST API plugin in a project and I've added my routes to a separate namespace (as recommended in the documentation). The javascript client included with the API ...
4
votes
1answer
615 views

Custom taxonomy query for a custom post type

I have a custom post type called news with a custom taxonomy called news category. Right now I have a template called taxonomy-news_category-press.php where press is one of the news_categories. The ...
4
votes
1answer
300 views

publish_post action hook doesn't give post_meta_data

I write the following function to get the post data on publish post but i see that post_meta is not available, its always empty. How do i retrieve the post meta data of a post on publish_post hook? ...
4
votes
1answer
877 views

has_term or in_category for Custom Post Types

I have property as a custom post type. I want to display a specific message if the property is in the sold category. To do that, I'm using the function below: if ( has_term('sold', 'category')) { ?&...
4
votes
0answers
61 views

Can I strip HTML tags in the “Compare Revisions” screen?

I am building a CMS for content editors that have zero tech savvy. They currently use a system called NewsCred that allows them to compare revisions much like how WordPress does when you visit /wp-...
4
votes
0answers
1k views

How to allow users login to WP from external domain and make REST requests

Basically what i want to do is: Use Wordpress as a login system and data storage for web-application on another domain. Make users able to register and perform REST calls from the application. Let ...
4
votes
1answer
160 views

Detecting Wordpress Customizer Panel

Recently started developing a Wordpress theme relying heavily on the customizer API. One thing I'm stuck with is detecting when a specific panel has been clicked or opened. Regular old "on click" ...
4
votes
1answer
35 views

Set subdomains live in a next step

I'm running a site on a different CMS and we are switching to WordPress soon. At the moment, there are sites like domain.at, sub1.domain.at and sub2.domain.at, served by one installation of the old ...

15 30 50 per page