{"id":2304,"date":"2026-10-20T08:30:41","date_gmt":"2026-10-20T07:30:41","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/same-map-marker-for-all-categories\/"},"modified":"2026-10-20T08:58:33","modified_gmt":"2026-10-20T07:58:33","slug":"same-map-marker-for-all-categories","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/same-map-marker-for-all-categories\/","title":{"rendered":"How to use the same map marker for every category"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">GeoDirectory gives each category two separate icons, so you can use one marker on the map and still keep a different icon for each category elsewhere on the site.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Map Icon is the image used as the marker on maps.<\/li>\n\n\n\n<li>Category Icon is a Font Awesome icon, used with the Category Color by the GD > Categories block and other places that list categories.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Both are on the edit screen for each category, for example Places > Categories.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set the same marker on each category<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Upload the marker image you want to use to the Media Library.<\/li>\n\n\n\n<li>Go to Places > Categories (or the categories of your other post types) and edit a category.<\/li>\n\n\n\n<li>In Map Icon, select your marker image.<\/li>\n\n\n\n<li>Leave the Category Icon and Category Color as they are, so the categories block keeps its own icons.<\/li>\n\n\n\n<li>Update the category, then repeat for the other categories.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Do not just clear the Map Icon. When it is empty and a Category Icon is set, GeoDirectory generates a marker from the Font Awesome icon and colour when you save the category.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The fallback marker for listings without a category marker is set in GeoDirectory > Settings > General, under Map Settings, as Default marker icon. It is an advanced setting, so click Show Advanced first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Force the default marker with a snippet<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you have a lot of categories, you can override the markers in code instead. Maps load their markers from the GeoDirectory markers API, and the snippet below replaces every category marker in that response with the Default marker icon. Add it with the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets plugin<\/a> or your child theme functions.php.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_filter( &#039;geodir_rest_markers_response&#039;, &#039;my_gd_use_default_marker_icon&#039;, 20, 2 );\nfunction my_gd_use_default_marker_icon( $response, $request ) {\n\tif ( empty( $response&#091;&#039;icons&#039;&#093; ) || ! is_array( $response&#091;&#039;icons&#039;&#093; ) ) {\n\t\treturn $response;\n\t}\n\n\t$icon = GeoDir_Maps::default_marker_icon( false );\n\t$size = GeoDir_Maps::get_marker_size( GeoDir_Maps::default_marker_icon( true ) );\n\n\tforeach ( $response&#091;&#039;icons&#039;&#093; as $key =&gt; $data ) {\n\t\t$response&#091;&#039;icons&#039;&#093;&#091; $key &#093;&#091;&#039;i&#039;&#093; = $icon;\n\t\t$response&#091;&#039;icons&#039;&#093;&#091; $key &#093;&#091;&#039;w&#039;&#093; = $size&#091;&#039;w&#039;&#093;;\n\t\t$response&#091;&#039;icons&#039;&#093;&#091; $key &#093;&#091;&#039;h&#039;&#093; = $size&#091;&#039;h&#039;&#093;;\n\t}\n\n\treturn $response;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Category Icon, Category Color and the category images are not touched, so your category lists look the same as before. After adding the snippet, clear any page or object cache and reload a map page. For more on map options see <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/core-widgets\/gd-map\/\">GD > Map<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GeoDirectory gives each category two separate icons, so you can use one marker on the map and still keep a different icon for each category elsewhere on the site. Both are on the edit screen for each category, for example Places > Categories. Set the same marker on each category Do not just clear the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433],"class_list":["post-2304","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2304"}],"version-history":[{"count":2,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2304\/revisions"}],"predecessor-version":[{"id":2730,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2304\/revisions\/2730"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2304"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2304"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}