Archived topic
Slugs for Element Locations
7 replies · Started by Paul on March 4, 2019
Is it possible to display page slugs instead of titles in Elements > Location? I have multiple "thank you" pages that use Thank You as the title (which I use for display in page headers) but it's difficult to tell which page is which when the drop down uses titles instead of the page slug.
See my screenshot. Here you can see I have two pages with the same title:

Hey Paul,
Definitely an issue right now. Unfortunately there isn't a fix unless you're comfortable editing core code.
In GPP 1.8, I've added a filter that allows you to show the ID next to the title. Let me know if you want instructions to make that change now.
Hey Tom, yes, I'm interested in that code. TIA!
FYI, my use case on this is building client landing pages using unique Facebook Lead Event pixels on each page and I need to be able to easily identify the pages. A page ID definitely is helpful in the meantime though.
Open elements/assets/admin/metabox.js and find line 185:
text: value.name
Replace it with:
text: elements.showID && value.id ? value.name + ': ' + value.id : value.name
Then, open elements/class-metabox.php and find line 97. On the line below it, add this:
'showID' => apply_filters( 'generate_elements_show_object_ids', false ),
It should look like this:
'choose' => __( 'Choose...', 'gp-premium' ),
'showID' => apply_filters( 'generate_elements_show_object_ids', false ),
Now you can add this function to your site:
add_filter( 'generate_elements_show_object_ids', '__return_true' );
Thanks Tom. That's awesome. However, I'll lose this with the next GPP update. Or will this be added to the next version?
This is added to the next version :)
OK, cool! Thanks a million.
No problem :)