• Resolved pixelpanther

    (@pixelpanther)


    Hi,

    I am trying to use the Edit Field > Custom Export Field to run a function with 2 variables. However, I am getting “an unknown error occurred” when previewing the output.

    My code looks like this:

    Custom export field:

    [set_city({Municipality},{Custom Municipality})]

    Function Editor:

    function set_city($muni = null, $custom_muni = null) {
       	if(!empty($custom_muni)) {
    	    return $custom_muni;
    	} else {
    	    return $muni;
    	}
    }

    Does the custom export field not support functions with more than one variable? Any thoughts?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hey @pixelpanther

    Does the custom export field not support functions with more than one variable?

    You can pass multiple arguments to functions in custom export fields.

    I am getting “an unknown error occurred” when previewing the output

    I am not able to reproduce this in my tests. Can you please try with the latest beta version of WP All Export?

    If that doesn’t help, then please replicate the problem at https://www.wpallimport.com/debug/ and open a ticket at https://www.wpallimport.com/support/ so that we can check this for you. Be sure to include a link to this thread in your message.

    Thread Starter pixelpanther

    (@pixelpanther)

    Hi @wpallimport

    I created a test site using your debug feature. The functions do not result in an “unknown error”, but they do not show any values in the preview output either.

    This time I did a simple post export. I added a new field to the export, selected “Custom export field” and entered the following in the input area:
    [exclaim({Title})]

    I have the following in my php function editor:

    
    <?php
    function exclaim($title) {
    	return $title . "!";
    }
    ?>
    

    (This time I am using a simple single-variable function.)

    Can you confirm that I am using the correct syntax for the custom export field to call a php function? e.g. square brackets to call function, curly braces to define DB variables

    Thanks

    Plugin Author WP All Import

    (@wpallimport)

    Hi @pixelpanther

    Can you confirm that I am using the correct syntax for the custom export field to call a php function?

    Yes, everything is correct.

    The functions do not result in an “unknown error”, but they do not show any values in the preview output either.

    This is fixed in the latest beta version of WP All Export.

    Thread Starter pixelpanther

    (@pixelpanther)

    @wpallimport

    Okay, thank you for confirming that this is a bug in the current non-beta version.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Export Field functions’ is closed to new replies.