Forum Replies Created

  • What @hube2 means is your basically asking a 2 part question.
    #1 – How to pull the relevant data / text per image.
    #2 – How to visually display the above data / text on each image in a small box giving credit to the original source.

    With #1 he linked you to how (with writing some simple code) you could pull the data / text you need from the image.
    This is the kind of help you would get from this site / forum. When you go on to ask for #2 specific “design” help also, then you would look for that kind of “specific” help from a site / forum where they concentrate on that.

    So, once you atleast try #1 and post back here your code where you atleast tried, then someone could probably help you the rest of the way.

    In your case, it would be more difficult to try and pull “the image’s source credit info” from the image itself.
    Why not just create custom field(s) for each image?

    News Article Image Name – Custom field for the image upload.
    News Article Text Source – Custom field for the text you want to use inside the box.
    News Article URL Source – Which is a url custom field to the source website / page.

    Then on your page, in a DIV (you will have to determine your CSS styling)..
    1. set the background image of the DIV to the image from the News Article Image Name custom field.

    2. create an inner div, set that to absolute position (lower left) and use the News Article Text Source custom field

    3. set that inner div’s hyperlink to News Article URL Source custom field.

  • So, basically the plugin creates data in the DB that 1. itself won’t remove, 2. provides no clear cut way for us to remove, 3. will endlessly create DB bloat anytime an entry is created / deleted including testing creations?

  • @mateusvitor As you can see we’ve been asking about this for YEARS now. I’m still astounded that devs of a professional plugin like this allow it to KNOWINGLY leave behind no longer needed data in the DB!! I thought one of the pillars to code development was to “clean up your mess”. You delete can delete all created custom fields.. and there is still data left behind in DB. You can even delete the plugin.. and there is still data left behind in DB.

  • @hube2
    Totally understand what you are saying.. but the problem still persists. And we are not talking about something “cosmetic” that can just be overlooked. The amount of leftover unused data in the DB increases and increases and increases forever.

    There are some key words.. unused data and increases forever. That alone should make this a priority.

    I’m pretty sure that EARLY in development this was noticed, begs the question, “Why wasn’t it addressed then?”
    And regardless of the answer to that.. KNOWING this unused data remains and increases, while not being addressed with a fix, rather the whole plugin needs to be re-developed or not.. is mind-boggling!

    Like you said in your comment, “Let say that you have a really large site of 10,000 posts”… Imagine the DB bloat making edits to this over time will create! Imagine this same site being a client of yours, and that client asks you why all of this unused data is just sitting here?

  • Yea, but the problem is, for example, just for cues.. there are 100’s of videos.. the cue point(s) vary.. For one video may have 2 cue points while another may have 20..

    Using your code above, if that video had 1 cue point.. then since there is no cue three.. that would leave numerous commas since the remaining fields are null, nothing would output… leaving commas behind

  • Yea, I’m aware of both method you have mentioned. But for 2 reasons they wont work for me. The first and major one is that I’m not fluent at all with writing js.. and second, this small piece of js is for a video player (for which I have a few hundred videos).. each video has different “cue points”, amongst a few other things that would make each run of this js unique just for that player / instance of js.

    Here is the js:

                    window.onload = function () {
                        var onPlayergo = {
                            cuepoints: [10, 26, 43, 65],
                            qualities: ["240p", "360p", "480p", "720p", "1080p"],
                            defaultQuality: "360p",
                            sources: [
                            { type: "video/mp4",    src: "/v-assets/video/test.mp4" }               
                        container = document.getElementById("player");
                        sidecarLeft = document.getElementById("sidecar-left");
                        sidecarRight = document.getElementById("sidecar-right");
                        msgOne = document.getElementById("msg-01");
                        msgTwo = document.getElementById("msg-02");
                        Player(container, {
                            clip: onPlayergo,
                            autoplay: false
                        }).on("cuepoint", function (e, api, cuepoint) {
                            if (cuepoint.time === onPlayergo.cuepoints[0]) {
                            else if (cuepoint.time === onPlayergo.cuepoints[1]) {
                            else if (cuepoint.time === onPlayergo.cuepoints[2]) {
    ==== REMOVED ====
                        }).on("beforeseek", function (e, api, pos) {
                            onPlayergo.cuepoints.forEach(function (cue) {
                                if (pos > cue) {
                                    if (!isNaN(cue)) {
                                      cue = {time: cue};
                                    api.trigger("cuepoint", [api, cue]);

    Ideally, I would like to put this code into a template file I have for this “player custom post type”.

    Above are hard coded cue points like:

    cuepoints: [10, 26, 43, 65],

    Now what I would like to do is have something like this:

    cuepoints: [custom_field_cue_one, custom_field_cue_two, custom_field_cue_three],

    So your methods above could work IF, I knew how to code js well enough. Thus the reason why I am asking for this less elegant method.

  • First of all, thanks for even spending the time and effort with the issue, I’m sure I speak for all above.

    In reference to the latter part of your last post, and keeping in mind I’m not even remotely close to having the dev knowledge you have.. but maybe sometimes someone without the knowledge could introduce something so elementary that it may have gotten overlooked 🙂

    You said, “What data do you think ACF could store to help make the clean up of data in each of the above conditions easier?

    Once again, coming from an elementary view.. If and when ACF creates a (_postmeta, _termmeta, _usermeta’, _commentmeta and options) it would also log that creation. Maybe chain it (create a relationship) of this specific creation and attach a unique serial number to it. So when it is “clean up time”, that specific and unique action was taken can then be read by ACF, and then go back and erase / clean up no longer used data.

    How could ACF overcome the limits of WP when it comes to the issue of performing all of the checking and deletion of data from the five locations where it can be stored (_postmeta, _termmeta, _usermeta’, _commentmeta and options) when each check/deletion will require calling a WP function to delete the specific data?

    Maybe not an ongoing cleaning process, but one initiated by admin when it’s an optimal time for that site. A tab / setting in admin to click “clean” button, accept warning and then clean. Obviously warning one to backup DB first.

  • Is there no way to:
    1. Have ACF log the data in creates in DB, and then remove based off of log?
    2. Have ACF prefix fields / data it creates with something like acf_and then the data or key, etc.
    3. Create it’s own table to read / write to?

    I think it’s understood that ACF is one of WPs top most used addons / plugins.. those that use it, know this.. I preface my comment saying that because I would gladly create another DB table OR entire DB just for ACF to utilize if it meant the unused data could then be safely removed.

  • @estevancarlos your right, not solved.. and its only been 3+ years

  • Doesn’t look like it, it’s been 2+ years

  • Good find @klox7 trying this on a dev site now.. hopefully it works.
    Still cant understand why ACF many versions after 2 years of updates hasn’t made this happen already..

  • John, it works like a charm!!

    Do you have a PayPal?

  • Ok, so I have plugin installed and tested with simple echo php, renders fine on edit page.


    Replaced that with the following code, and clicked update. It doesn’t save php and changes the enhanced field into an empty plain text field.

    The following code breaks the enhanced msg field and makes it revert to a simple text field because of the multiple open / closing php tags.

      // change the field type to the type
      // of field you want this run on
      // use priority of 1 for before field
      // use priority of 20 for before field  
      add_action('acf/render_field/type=url', 'field_name_render_url_image', 20, 1);
      // change the function name to something unique
      function field_name_render_url_image($field) {
         // change $field name to 
         // the field to add the image to 
        $field_name = 'video_poster_text';
        if ($field['_name'] != $field_name) {
          // not our field
        // uncomment this if you want to see value of $field
        //echo '<pre>'; print_r($field); echo '</pre>';
        // get the post id
        global $post;
        $post_id = $post->ID;
        // get the current value of the field
        // using get_post_meta to avoid confilcts
        $url = get_post_meta($post_id, $field_name, true);
        if (!$url) {
          // nothing has been entered
          ?><p>Enter a URL and Update to View.</p><?php 
        // make sure the url is an image
        // alter regex to change allowed image extensions
        if (!preg_match('/\.(jpg|jpeg|png|gif)$/i', $url)) {
          // not an image we want to allow
          ?><p>The Entered is Not A Valid Image URL. Enter a Valid Image URL and Update to View.</p><?php 
        // if we get here then show the image
          <img src="<?php echo $url; ?>" />
      } // end function field_name_render_url_image
  • Wow.. thanks!! I’m gonna try and implement right now.. I shall return!

  • Yea, I saw that one.. but when I saw just the generic bit of php used in the sample code, I digressed because of my limited php coding knowledge. BUT, with the use of that enhanced msg plugin, I could possibly manage. Well, atleast I now have two methods to try 🙂

    I’m literally JUST finishing up my columns with Admin Columns Pro. And this was my last thing to tackle to complete this project.

  • Hey now! that plugin should work. Ofcourse i try to stick to minimum plugins as possible, but I can see this working perfectly.. AND, I can hide the field label, which should help it visually look like a part of my simple custom text field that this is for.

    Going to play with this right now.. thank you John for the plugin link, and more importantly your time!

  • Hey John, first and foremost thanks for even responding! I know that my question is pretty elementary for the coders here. In fact, I was thinking that I may have not even asked the question using the right terms.

    I have no problem searching for the info, in fact I kinda look forward to searching for this kinda thing because I always learn 10 other things I never knew lol.

    Reason why my question mentions a simple text input was because I was trying to keep it simple, for me to learn and also for an easier answer from a dev. I was thinking that i could do something as simple as:

    because I do have a good plugin that allows me to do php right in editor
    <img src="<?php the_field('direct_image_url'); ?>" />

    But like you said, it’s gonna take hook and filters, which may be over my head for now. I think I first need to learn how to even display / render generic custom fields on the edit page.. and then revisit this.

  • Elliott you said, “In time my friend..” In time? 2 years?

  • You forgot to mention if used as a seperate php file, how does one get WP to recognize it?

  • Wow, it’s almost 2 years later, and we are still not able to remove old unused DB records created by ACF?

    I would think keeping a clean tidy DB would be reason enough for this to be implemented!

    Since this doesn’t seem to be important, can someone give us an official way to SAFELY remove this useless fields manually?

  • Anyone, has this been addressed yet?

  • Has then been addressed in the newer version 4.. or even in the beta 5?

Viewing 25 posts - 1 through 25 (of 30 total)