WP Rocket - WordPress Caching Plugin

Matching site creation using WordPress [HivePress] Changing the address input field in listings (profiles) to optional

At HanamiWEB Online School,

●Ask questions in real-time in the virtual study room!

●Ask as many questions as you want via chat!

●E-learning materials that you can learn as much as you want, 24 hours a day!

All included for just 2,500 yen/month!

We will explain the code introduced in the HivePress code recipe.

Making the address field optional for listings

<?php
add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset( $attributes['location'] ) ) {
			$attributes['location']['edit_field']['required'] = false;
		}
 
		return $attributes;
	},
	1000
);

Make the address field in your profile optional

<?php
add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset( $attributes['location'] ) ) {
			$form['fields']['location']['required'] = false;
		}
 
		return $attributes;
	},
	1000
);

Add to function.php

The code is added to function.php.

  • Create a child theme and add it to function.php
  • Added using the code snippets plugin

Please edit function.php in one of two ways.

Finally, go to Settings > Permalinks and click the [Update] button to reload the permalinks.

This blog post explains the prerequisites you need to know before editing function.php!

Released as soon as the next morning! Weekends and holidays are also available!

Super rush website creation plan

We offer a rush website creation plan for those who need a website in a hurry!

We can publish your content as soon as the next morning, even on weekends and holidays! If you have any questions, please check the details below!

Latest Articles

How to Enhance EEAT with WordPress | Settings and Design Improvements Necessary for AI-Driven Traffic
(Latest 2026) How to check AI traffic with GA4
[2026 Latest] How to check the number of visits from generated AI using GA4's exploration function
Error message: Allowed memory size of 268435456 bytes exhausted (tried to allocate 14684160 bytes) Error: On Lollipop
en_USEnglish