[map query="tag=cycling" ... not filtering.

I have seen someone mention this problem before, but I can not find it again.

Anyway, I am able to show [map query="all"] however after countless permutations I can not get [map query="tag=my_tag" format to load any markers.

[map query="tag=cycling" overlay="true" disable_scroll="true" show_images="false" show_posts="false" height="200px" width="100%"]

Shows zero markers. I am going to recreate all the posts and see if that is an issue, but in the meantime, perhaps there is a simple fix I am overlooking.

Thank you,


  • jamie


    I should have mentioned these post and maps are being created dynamically after user entry with the [location address="VALUE"] shortcode.

    The value attribute is set by a database reference to the zip code. The individual posts are okay the values are being set, but the query doesn't appear to be recognizing them for the mashup.

    I saw another thread when I was first getting started that talked about this, and I believe there was a solution. I hope so, this is key.

    Any suggestions?



  • Jack Kitterhing

    Hi there @jamie,

    Hope you're well today and thanks for your question! :slight_smile:

    As they are being used dynamically, are you using custom code to then generate the map_query tag parameter?

    If you are, can you share that custom code here please for me to take a look at.

    Could you also grant me support access via the wp-admin > WPMU DEV > support > support access and click "Grant Access".


    Kind Regards

  • jamie


    thank you for your patience, I have been out in he field and not able to respond.

    Just to get you a little more details on your questions:

    As they are being used dynamically, are you using custom code to then generate the map_query tag parameter?

    The posts are being created dynamically the tag parameter (does anyone user that word anymore?) is spelled out, so the map query does not contain any dynamic content directly.

    If you are, can you share that custom code here please for me to take a look at.

    The code that generates the posts is part of the Formidable Pro plugin.

    Could you also grant me support access via the wp-admin > WPMU DEV > support > support access and click "Grant Access".

    I will go ahead and allow you access. You will find I have recently added buddy press elements (it new to me but I thought it might be worth exploring due to wide support) and the site a little blown apart right now as I try to pull all the pieces back together.

    If you want to see the map query working in "all" mode, you can visit this link:


    If you want to see the maps working on individual listing posts created dynamically, you can click the "im ready" button on the right hand side of the each of the listings.

    If you would like to see the maps that are not working:


    I am going to add a pages to the menu to make it easier to get around while I rebuild the structure of the site.

    Let me know if you need anything,


  • Philipp Stracker

    Hi Jamie,

    we have checked the maps plugin in more detail now and I possibly have the solution for your issue:

    Add "&post_type=any" to your query!
    I think your events are not default WordPress posts, but a custom post type provided by some plugin. The Maps plugin will by default only check WordPress posts for maps and ignore custom post types. So you have to explicitely tell the plugin to check any posts that have a matching tag.. your shortcode will possibly look like this in the end:

    [map query="tag=cycling&post_type=any" overlay="true" ... ]

    Please let us know if this is doing the trick for you!
    Thanks, Philipp :slight_smile:

  • jamie


    Its ironic you mention that. Last night i was trying to post my whole shortcode to havenyou consider a missing piece.

    I was reading another support thread involving the post_type parameter and notices it was requiring some explicit instructions to detrrmine whixh posts, so your theory is very promising as the fact it doesnt post any markers fits the mold that there is no posts being processed.

    I am on the road at the moment but i am excited to get home and give this a whirl. Thank you very much for the follow up.

    I will let you know how it goes.


  • jamie

    Did not change the results with this shortcode:

    [map query="tag=Cycling&post_type=any" overlay="true" disable_scroll="true" show_images="false" show_posts="false" height="200px" width="100%"]

    the posts are standard wordpress Posts, as well.

    i can create a specific post type, but I would like to be able to have different tags to filter based on user input.

    Hopefully we can get closer...thank again. Let's keep thinking about it.


  • jamie


    Thank you for letting me know about update.

    I have updated to latest version and I it does not appear to be working.

    There are a few pages with slight variations of the script. This page: http://www.readytoplaynow.com/cycling-events/

    has the shortcode:

    [map query="tag=Cycling&post_type=any" overlay="true" disable_scroll="true" show_images="false" show_posts="false" height="200px" width="100%"]

    Page is titled: Cycling Events

    Thanks again,


    PS, I have granted access.

  • Philipp Stracker

    Hi Jamie,

    I have just had a look at your site.
    The plugin logic is like this:

    - All maps are displayed, since they are fetched without any kind of filter. There's nothing that can go wrong...

    - The Tag-Specific maps are fetched by first getting all posts that belong to a tag and then finding all maps that are linked with these posts.

    The reason why your tag-based map is empty is that none of your maps are actually linked to a post... You can check if this link exists by opening the map options dialog for any map. In the top of the dialog is a checkbox "Associate map with this post" and a list of associated posts (no list in your case since no links exist)

    I have linked a map with one post to test this and it worked.
    So the actual issue is, that the [location] shortcode does not associate the newly created maps with the post... I have added this to the google maps todo list and we will have a closer look on this as soon as possible.

    I'll update this thread once I have a definite feedback for you on the solution!
    Thanks, Philipp

  • jamie


    Thanks for the feedback.

    I see you were able to get a marker to appear. Excellent sleuthing!

    Is it possible I have forgotten to set an attribute in the shortcode? Correct me if I am wrong, but with a mashup the link to a post might be hard to drill down, because there are multiple posts involved, unless this is just an arbitrary flag that needs to be set. I am little confused, because I thought the whole idea of the tag is to combine all the different posts.

    If you can add any more details, like the actual php files that you feel are responsible for the lack of the post association, I would be grateful. Until then I will wait to hear back.

    Trying to find the map options dialog box you allude to...

    Thank you,


  • Philipp Stracker

    Hi Jamie,

    I have created a very short screencast for you how I got that marker on the map: http://monosnap.com/file/Uc5q9QDALocqLpip0IOJjC17m8bwDc

    - Open an post and remember the address ID
    - Now edit the map with the related address ID
    - In the options screen check the checkbox "Associate map with post"
    - Apply + Save changes

    Problem was, that the map is not linked with the post.
    Because of this the tag-filter does not find any maps (the tag is applied to the post but not to the map)

  • jamie

    In custom fields section of the options you can find:

    When these fields are found, I want to
    (A new map will be automatically created, using the defaults you specified above )
    Associate the new map to post: Yes No
    Automatically show the map: Yes No
    If previous option is set to "Yes", the new map will be shown the post body

    I can not find any code behind that check box (in bold above) or even the custom code portion of the script, but my concern that maybe it could not be set prior to post creation is temporarily lifted.

    I'll keep looking.


  • jamie

    Found this bit of script:

    * Autocreates and saves a map from supplied values.
    public function autocreate_map( $post_id, $lat, $lon, $add ) {
    $opts = apply_filters( 'agm_google_maps-options', get_option( 'agm_google_maps' ) );

    $do_associate = @$opts['custom_fields_options']['associate_map'];

    if ( ! $lat || ! $lon ) {
    $geo = $this->_address_to_marker( $add );
    } else {
    $geo = $this->_position_to_marker( $lat, $lon );

    if ( ! $geo ) {
    return false; // Geolocation failed

    $map = $this->get_map_defaults();
    $map['title'] = $geo['title'];
    $map['show_map'] = 1;
    $map['show_markers'] = 1;
    $map['markers'] = array( $geo );
    if ( $do_associate ) {
    $map['post_ids'] = array("{$post_id}");

    $map_id = $this->save_map( $map );

    if ( ! $map_id ) {
    return false;

    update_post_meta( $post_id, 'agm_map_created', $map_id );
    return $map_id;

  • jamie

    I have followed the process all the way back to the form that takes user input to associate the map to the post.

    echo ' ' . $this->_create_cfyn_box( 'associate_map', @$opt['associate_map'] ) . '';

    At this point I need a way to see if this value is being set in $opt array:
    it appears the $opt array is not getting the "associate_map" value despite being set in the options requester.

    Probably only maps created in the map tool look at these options. If I can just set the post meta data with an add_action, it might be best approach.

  • jamie

    I have look at the code up and down and I am grateful to better understand the plugin structure. I am still at a loss why this is not working.

    When the option is set to associate map with the post, how can the [location] shortcode not set the map to associate?

    I notice some other parameters I set do not seem to make it own the line and I am wondering if the way formidable is making the posts the map plugin is not able to set the "associate_map" among other values because the post contains the location tag and not the map tag. I doing some experimentation.

    Spent all day on this yesterday and plan to focus on it again, but I hope to have this resolved by the end of the week. Is it feasible? I guess we'll find out. :slight_smile:

  • jamie

    It looks like the problem stems from using ZIP code as the value for generating maps.

    I changed the custom field to a city, state or full address and seems like it sets the associate option correctly.

    I did play with the $map_id = $model->autocreate_map( false, false, false, $address ); function call to include the post_id, but while it didn't break it, it appears to work without the modification. I changed two things at once in debugging, oops!

    So that said, it appears somewhere in the process of the [location] shortcode, when it tries to determine if the data is coordinates or address, it gets confused when there is just a zip code.

    The best guess I have so far.

    For now it appears to be adding the associate_map correctly and the posts appear on the mashups as planned.

    Thank you for your effort.